Skip to content

🐧 Add native title bar option for better Linux window resizing - #387

Closed
BluewhaleYF wants to merge 6 commits into
Solsynth:v3from
BluewhaleYF:v3
Closed

🐧 Add native title bar option for better Linux window resizing#387
BluewhaleYF wants to merge 6 commits into
Solsynth:v3from
BluewhaleYF:v3

Conversation

@BluewhaleYF

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread assets/i18n/en-US.json Outdated
"settingsUnknownRoom": "Unknown Room",
"settingsUpdate": "Update",
"settingsWindowOpacity": "Window Opacity",
"settingsLinuxNativeTitleBar": "Use Native Title Bar",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually you can expand this to all OS, maybe some users don't like the customized titlebar?
that will be a great new customize settings.

Besides, you don't need re-open a PR,
if you push to your forked repo, the PR will updated automatically.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can expand this function to Windows
The problem is that I don't have any machine running macOS, so maybe I need your help.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, looks like you forgot change the key of localization

Comment thread assets/i18n/en-US.json Outdated
"settingsUnknownRoom": "Unknown Room",
"settingsUpdate": "Update",
"settingsWindowOpacity": "Window Opacity",
"settingsLinuxNativeTitleBar": "Use Native Title Bar",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, looks like you forgot change the key of localization

Comment thread lib/core/config.dart Outdated
return prefs.getBool(kAppDeveloperMode) ?? false;
});

final linuxNativeTitleBarProvider =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's better to merge the key with the appsettings provider, since it just a single boolean key.
And you can use @riverpod annotation + riverpod_generator to reduce the loc

Comment thread lib/misc/settings.dart Outdated
),
),
),
if (Platform.isLinux)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you've expanded this feature, why not expand this if conidtion as well?

Comment thread lib/main.dart Outdated
}
}

final useLinuxNativeTitleBar = Platform.isLinux

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break on web, because web don't have all Platform.. Even running it will break the entire app.
Use !kIsWeb to skip following code to avoid run the non-exists platform api

@LittleSheep2Code
LittleSheep2Code marked this pull request as draft July 27, 2026 11:43
@LittleSheep2Code

Copy link
Copy Markdown
Contributor

Feel free to make this PR back to ready to merge state when you done the changes.

- Merge the native title bar setting into the app settings provider
- Replace manual provider implementation with @riverpod generator
- Rename the localization key consistently
- Expand platform checks for desktop support
- Guard platform-specific APIs on web using !kIsWeb
@BluewhaleYF
BluewhaleYF marked this pull request as ready for review July 27, 2026 13:00
@LittleSheep2Code
LittleSheep2Code self-requested a review July 27, 2026 13:07
Comment thread assets/i18n/es-ES.json
"settingsTtsVolume": "Volumen",
"settingsUnknownRoom": "Unknown Room",
"settingsWindowOpacity": "Window Opacity",
"settingsLinuxNativeTitleBar": "Usar barra de título nativa",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bro forgot multi language

Comment thread lib/core/config.dart
const kAppFestivalFeatures = 'app_feastival_features';
const kAppWindowSize = 'app_window_size';
const kAppWindowOpacity = 'app_window_opacity';
const kAppLinuxUseNativeTitleBarLegacy = 'app_linux_use_native_title_bar';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait actually why there are two keys

Comment thread lib/main.dart
final useDesktopNativeTitleBar =
!kIsWeb && (Platform.isLinux || Platform.isWindows)
? (prefs.getBool(kAppDesktopUseNativeTitleBar) ??
prefs.getBool(kAppLinuxUseNativeTitleBarLegacy) ??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have not shipped this feature why you already worry about the backward compatibility?

Comment thread lib/main.dart
Logger.root.info(
"[SplashScreen] Desktop window is ready with size: ${initialSize.width}x${initialSize.height}"
"${isWayland ? " (Wayland frameless fix applied)" : ""}",
"${isWayland && (!Platform.isLinux || !useDesktopNativeTitleBar) ? " (Wayland frameless fix applied)" : ""}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems you like writing code twice instead of adding a variable

But that will cause some issue if you change the condition and forgot the log

Comment thread lib/misc/settings.dart
final isDesktop =
!kIsWeb && (Platform.isWindows || Platform.isMacOS || Platform.isLinux);
!kIsWeb &&
switch (currentPlatform) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly use the flutter built variable here

Why you don't like writing code twice here?

if (kIsWeb ||
!isDesktop ||
!(currentPlatform == TargetPlatform.linux ||
currentPlatform == TargetPlatform.windows)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you think this code is ugly and duplicate?

ShakeDetector? detector;
if (!kIsWeb && (Platform.isIOS || Platform.isAndroid) && shakeEnabled) {
if (!kIsWeb &&
(currentPlatform == TargetPlatform.iOS ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The target platform is available in all platfrom so you don't need to add the web check

static bool get isPlatformDesktop =>
!kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows);
!kIsWeb &&
switch (defaultTargetPlatform) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This place as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we prefer to use the dart io platform check

I forgot the reason, but follow the projects style is better

@LittleSheep2Code

Copy link
Copy Markdown
Contributor

Upstream already included this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants