diff --git a/lib/controllers/settings_sections.dart b/lib/controllers/settings_sections.dart index df1e64d..0ba0620 100644 --- a/lib/controllers/settings_sections.dart +++ b/lib/controllers/settings_sections.dart @@ -77,6 +77,40 @@ class SettingsSectionsController title: "Behavior", icon: Icons.psychology, settings: .new([ + .new( + title: "All Rooms In Home", + description: "Show all rooms in home, instead of just ones that aren't in spaces", + icon: Icons.home, + builder: (title, description, icon) => SwitchListTile( + title: Text(title), + subtitle: Text(description), + secondary: Icon(icon), + value: settings.showAllInHome, + onChanged: (value) => ref + .watch(SettingsController.provider.notifier) + .set(settings.copyWith(showAllInHome: value)) + .onError(showError), + ), + ), + if (!Platform.isAndroid && !Platform.isIOS) + .new( + title: "Show Minimize Button", + description: + "Enable this to add a minimize button to the appbar", + icon: Icons.minimize, + builder: (title, description, icon) => SwitchListTile( + title: Text(title), + subtitle: Text(description), + secondary: Icon(icon), + value: settings.showMinimizeButton, + onChanged: Platform.isLinux + ? (value) => ref + .watch(SettingsController.provider.notifier) + .set(settings.copyWith(showMinimizeButton: value)) + .onError(showError) + : null, + ), + ), .new( title: "Linux Mobile Mode", description: "Enables some fixes for Linux mobile, e.g. disabling dragging appbar for moving window.", @@ -94,23 +128,6 @@ class SettingsSectionsController : null, ), ), - .new( - title: "All Rooms In Home", - description: "Show all rooms in home, instead of just ones that aren't in spaces", - icon: Icons.home, - builder: (title, description, icon) => SwitchListTile( - title: Text(title), - subtitle: Text(description), - secondary: Icon(icon), - value: settings.showAllInHome, - onChanged: Platform.isLinux - ? (value) => ref - .watch(SettingsController.provider.notifier) - .set(settings.copyWith(showAllInHome: value)) - .onError(showError) - : null, - ), - ), ]), ), ]), diff --git a/lib/models/settings.dart b/lib/models/settings.dart index 5237e89..97cd6ca 100644 --- a/lib/models/settings.dart +++ b/lib/models/settings.dart @@ -11,6 +11,7 @@ class const Settings({ final bool useDynamicTheming = true, final bool linuxMobileMode = false, final bool showAllInHome = false, + final bool showMinimizeButton = false, }) with _$Settings { Map toJson() => _$SettingsToJson(this); diff --git a/lib/widgets/appbar.dart b/lib/widgets/appbar.dart index 33727ac..a6489a2 100644 --- a/lib/widgets/appbar.dart +++ b/lib/widgets/appbar.dart @@ -51,6 +51,17 @@ final class const Appbar({ actions: [ ...actions, if (!(Platform.isAndroid || Platform.isIOS)) ...[ + if (ref + .watch(SettingsController.provider) + .whenOrNull( + data: (settings) => settings.showMinimizeButton, + ) ?? + false) + IconButton( + tooltip: "Minimize window", + onPressed: windowManager.minimize, + icon: const Icon(Icons.minimize), + ), if (!Platform.isLinux) IconButton( tooltip: "Maximize window",