mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
feat(defaults): adding support to control center
This commit is contained in:
parent
5c74ab862c
commit
d71aa30b41
5 changed files with 146 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
./system/activation-scripts.nix
|
||||
./system/applications.nix
|
||||
./system/defaults-write.nix
|
||||
./system/defaults/controlcenter.nix
|
||||
./system/defaults/LaunchServices.nix
|
||||
./system/defaults/NSGlobalDomain.nix
|
||||
./system/defaults/GlobalPreferences.nix
|
||||
|
|
|
@ -17,6 +17,7 @@ let
|
|||
SoftwareUpdate = defaultsToList "/Library/Preferences/com.apple.SoftwareUpdate" cfg.SoftwareUpdate;
|
||||
|
||||
# userDefaults
|
||||
controlcenter = defaultsToList "~/Library/Preferences/ByHost/com.apple.controlcenter" cfg.controlcenter;
|
||||
GlobalPreferences = defaultsToList ".GlobalPreferences" cfg.".GlobalPreferences";
|
||||
LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices;
|
||||
NSGlobalDomain = defaultsToList "-g" cfg.NSGlobalDomain;
|
||||
|
@ -71,6 +72,7 @@ in
|
|||
|
||||
system.activationScripts.userDefaults.text = mkIfAttrs
|
||||
[
|
||||
controlcenter
|
||||
GlobalPreferences
|
||||
LaunchServices
|
||||
NSGlobalDomain
|
||||
|
@ -113,6 +115,7 @@ in
|
|||
${concatStringsSep "\n" ActivityMonitor}
|
||||
${concatStringsSep "\n" CustomUserPreferences}
|
||||
${concatStringsSep "\n" WindowManager}
|
||||
${concatStringsSep "\n" controlcenter}
|
||||
|
||||
${optionalString (length dock > 0) ''
|
||||
# Only restart Dock if current user is logged in
|
||||
|
|
100
modules/system/defaults/controlcenter.nix
Normal file
100
modules/system/defaults/controlcenter.nix
Normal file
|
@ -0,0 +1,100 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options = {
|
||||
|
||||
system.defaults.controlcenter.BatteryShowPercentage = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > Battery
|
||||
|
||||
Show a battery percentage in menu bar. Default is null.
|
||||
'';
|
||||
};
|
||||
|
||||
system.defaults.controlcenter.Sound = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
apply = v: if v == null then null else if v == true then 18 else 24;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > Sound
|
||||
|
||||
Show a sound control in menu bar . Default is null.
|
||||
|
||||
18 = Display icon in menu bar
|
||||
24 = Hide icon in menu bar
|
||||
'';
|
||||
};
|
||||
|
||||
system.defaults.controlcenter.Bluetooth = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
apply = v: if v == null then null else if v == true then 18 else 24;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > Bluetooth
|
||||
|
||||
Show a bluetooth control in menu bar. Default is null.
|
||||
|
||||
18 = Display icon in menu bar
|
||||
24 = Hide icon in menu bar
|
||||
'';
|
||||
};
|
||||
|
||||
system.defaults.controlcenter.AirDrop = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
apply = v: if v == null then null else if v == true then 18 else 24;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > AirDrop
|
||||
|
||||
Show a AirDrop control in menu bar. Default is null.
|
||||
|
||||
18 = Display icon in menu bar
|
||||
24 = Hide icon in menu bar
|
||||
'';
|
||||
};
|
||||
|
||||
system.defaults.controlcenter.Display = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
apply = v: if v == null then null else if v == true then 18 else 24;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > Display
|
||||
|
||||
Show a Screen Brightness control in menu bar. Default is null.
|
||||
|
||||
18 = Display icon in menu bar
|
||||
24 = Hide icon in menu bar
|
||||
'';
|
||||
};
|
||||
|
||||
system.defaults.controlcenter.FocusModes = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
apply = v: if v == null then null else if v == true then 18 else 24;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > Focus
|
||||
|
||||
Show a Focus control in menu bar. Default is null.
|
||||
|
||||
18 = Display icon in menu bar
|
||||
24 = Hide icon in menu bar
|
||||
'';
|
||||
};
|
||||
|
||||
system.defaults.controlcenter.NowPlaying = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.bool;
|
||||
apply = v: if v == null then null else if v == true then 18 else 24;
|
||||
default = null;
|
||||
description = ''
|
||||
Apple menu > System Preferences > Control Center > Now Playing
|
||||
|
||||
Show a Now Playing control in menu bar. Default is null.
|
||||
|
||||
18 = Display icon in menu bar
|
||||
24 = Hide icon in menu bar
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -489,3 +489,38 @@ defaults write com.apple.WindowManager 'StandardHideWidgets' $'<?xml version="1.
|
|||
<plist version="1.0">
|
||||
<true/>
|
||||
</plist>'
|
||||
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'AirDrop' $'<?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">
|
||||
<integer>18</integer>
|
||||
</plist>'
|
||||
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'BatteryShowPercentage' $'<?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 ~/Library/Preferences/ByHost/com.apple.controlcenter 'Bluetooth' $'<?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">
|
||||
<integer>18</integer>
|
||||
</plist>'
|
||||
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'Display' $'<?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">
|
||||
<integer>24</integer>
|
||||
</plist>'
|
||||
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'FocusModes' $'<?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">
|
||||
<integer>24</integer>
|
||||
</plist>'
|
||||
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'NowPlaying' $'<?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">
|
||||
<integer>18</integer>
|
||||
</plist>'
|
||||
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter 'Sound' $'<?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">
|
||||
<integer>24</integer>
|
||||
</plist>'
|
|
@ -94,6 +94,13 @@
|
|||
true;
|
||||
};
|
||||
};
|
||||
system.defaults.controlcenter.BatteryShowPercentage = true;
|
||||
system.defaults.controlcenter.Sound = false;
|
||||
system.defaults.controlcenter.Bluetooth = true;
|
||||
system.defaults.controlcenter.AirDrop = true;
|
||||
system.defaults.controlcenter.Display = false;
|
||||
system.defaults.controlcenter.FocusModes = false;
|
||||
system.defaults.controlcenter.NowPlaying = true;
|
||||
test = lib.strings.concatMapStringsSep "\n"
|
||||
(x: ''
|
||||
echo >&2 "checking defaults write in /${x}"
|
||||
|
|
Loading…
Reference in a new issue