add setting for showing minimize button

This commit is contained in:
Henry Hiles 2026-10-05 11:26:26 -04:00
commit 9c83ae573a
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
3 changed files with 44 additions and 15 deletions

View file

@ -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,
),
),
]),
),
]),

View file

@ -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<String, Object?> toJson() => _$SettingsToJson(this);

View file

@ -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",