1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

(feature) Add Stage Manager (com.apple.WindowManager) settings as system.defaults.windowmanager

All credits go to @AlexOwl. Their [PR](https://github.com/LnL7/nix-darwin/pull/505)
looked abandonned so I reported their changes and addressed the change
requests.
This commit is contained in:
Maxime Daffis 2024-07-11 14:56:29 +02:00
parent b47af86286
commit 3dd14e466c
5 changed files with 128 additions and 0 deletions

View file

@ -32,6 +32,7 @@
./system/defaults/trackpad.nix
./system/defaults/universalaccess.nix
./system/defaults/ActivityMonitor.nix
./system/defaults/WindowManager.nix
./system/etc.nix
./system/keyboard.nix
./system/launchd.nix

View file

@ -32,6 +32,7 @@ let
trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad;
universalaccess = defaultsToList "com.apple.universalaccess" cfg.universalaccess;
ActivityMonitor = defaultsToList "com.apple.ActivityMonitor" cfg.ActivityMonitor;
WindowManager = defaultsToList "com.apple.WindowManager" cfg.WindowManager;
CustomUserPreferences = flatten (mapAttrsToList (name: value: defaultsToList name value) cfg.CustomUserPreferences);
CustomSystemPreferences = flatten (mapAttrsToList (name: value: defaultsToList name value) cfg.CustomSystemPreferences);
@ -85,6 +86,7 @@ in
universalaccess
ActivityMonitor
CustomUserPreferences
WindowManager
]
''
# Set defaults
@ -107,6 +109,7 @@ in
${concatStringsSep "\n" universalaccess}
${concatStringsSep "\n" ActivityMonitor}
${concatStringsSep "\n" CustomUserPreferences}
${concatStringsSep "\n" WindowManager}
${optionalString (length dock > 0) ''
# Only restart Dock if current user is logged in

View file

@ -0,0 +1,76 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.WindowManager.GloballyEnabled = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Enable Stage Manager
Stage Manager arranges your recent windows into a single strip for reduced clutter and quick access. Default is false.
'';
};
system.defaults.WindowManager.EnableStandardClickToShowDesktop = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Click wallpaper to reveal desktop
Clicking your wallpaper will move all windows out of the way to allow access to your desktop items and widgets. Default is true.
false means "Only in Stage Manager"
true means "Always"
'';
};
system.defaults.WindowManager.AutoHide = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Auto hide stage strip showing recent apps. Default is false.
'';
};
system.defaults.WindowManager.AppWindowGroupingBehavior = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Grouping strategy when showing windows from an application.
false means "One at a time"
true means "All at once"
'';
};
system.defaults.WindowManager.StandardHideDesktopIcons = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Hide items on desktop.
'';
};
system.defaults.WindowManager.HideDesktop = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Hide items in Stage Manager.
'';
};
system.defaults.WindowManager.StandardHideWidgets = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Hide widgets on desktop.
'';
};
system.defaults.WindowManager.StageManagerHideWidgets = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Hide widgets in Stage Manager.
'';
};
};
}

View file

@ -375,3 +375,43 @@ defaults write com.apple.Safari 'com.apple.Safari.ContentPageGroupIdentifier.Web
<plist version="1.0">
<true/>
</plist>'
defaults write com.apple.WindowManager 'AppWindowGroupingBehavior' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<true/>
</plist>'
defaults write com.apple.WindowManager 'AutoHide' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<false/>
</plist>'
defaults write com.apple.WindowManager 'EnableStandardClickToShowDesktop' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<false/>
</plist>'
defaults write com.apple.WindowManager 'GloballyEnabled' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<false/>
</plist>'
defaults write com.apple.WindowManager 'HideDesktop' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<false/>
</plist>'
defaults write com.apple.WindowManager 'StageManagerHideWidgets' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<true/>
</plist>'
defaults write com.apple.WindowManager 'StandardHideDesktopIcons' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<false/>
</plist>'
defaults write com.apple.WindowManager 'StandardHideWidgets' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<true/>
</plist>'

View file

@ -64,6 +64,14 @@
system.defaults.ActivityMonitor.SortColumn = "CPUUsage";
system.defaults.ActivityMonitor.SortDirection = 0;
system.defaults.ActivityMonitor.OpenMainWindow = true;
system.defaults.WindowManager.GloballyEnabled = false;
system.defaults.WindowManager.EnableStandardClickToShowDesktop = false;
system.defaults.WindowManager.AutoHide = false;
system.defaults.WindowManager.AppWindowGroupingBehavior = true;
system.defaults.WindowManager.StandardHideDesktopIcons = false;
system.defaults.WindowManager.HideDesktop = false;
system.defaults.WindowManager.StandardHideWidgets = true;
system.defaults.WindowManager.StageManagerHideWidgets = true;
system.defaults.CustomUserPreferences = {
"NSGlobalDomain" = { "TISRomanSwitchState" = 1; };
"com.apple.Safari" = {