1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

darwin: keep the options for the "defaults" system up-to-date

- update the option names for toggling Safari's developer menu
- deprecate com.apple.menuextra.battery.ShowPercent
This commit is contained in:
midchildan 2021-11-30 00:18:26 +09:00 committed by Robert Helgesson
parent de54d513c7
commit 0d58582887
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 68 additions and 16 deletions

View file

@ -2259,6 +2259,16 @@ in
A new module is available: 'programs.less'. A new module is available: 'programs.less'.
''; '';
} }
{
time = "2021-11-29T15:15:59+00:00";
condition = hostPlatform.isDarwin;
message = ''
The option 'targets.darwin.defaults."com.apple.menuextra.battery".ShowPercent'
has been deprecated since it no longer works on the latest version of
macOS.
'';
}
]; ];
}; };
} }

View file

@ -48,6 +48,24 @@ in {
platforms.darwin) platforms.darwin)
]; ];
warnings = let
batteryPercentage =
attrByPath [ "com.apple.menuextra.battery" "ShowPercent" ] null
cfg.defaults;
webkitDevExtras = attrByPath [
"com.apple.Safari"
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled"
] null cfg.defaults;
in optional (batteryPercentage != null) ''
The option 'com.apple.menuextra.battery.ShowPercent' no longer works on
macOS 11 and later. Instead, open System Preferences, go to "Dock &
Menu Bar", select "Battery", and toggle the checkbox labeled "Show
Percentage."
'' ++ optional (webkitDevExtras != null) ''
The option 'com.apple.Safari.com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled'
is no longer present in recent versions of Safari.
'';
home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] '' home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] ''
$VERBOSE_ECHO "Configuring macOS user defaults" $VERBOSE_ECHO "Configuring macOS user defaults"
${concatStringsSep "\n" activationCmds} ${concatStringsSep "\n" activationCmds}

View file

@ -98,7 +98,13 @@ in {
"com.apple.menuextra.battery".ShowPercent = mkNullableOption { "com.apple.menuextra.battery".ShowPercent = mkNullableOption {
type = types.enum [ "YES" "NO" ]; type = types.enum [ "YES" "NO" ];
example = "NO"; example = "NO";
description = "Whether to show battery percentage in the menu bar."; description = ''
This option no longer works on macOS 11 and later. Instead, open System
Preferences, go to "Dock & Menu Bar", select "Battery", and toggle
the checkbox labeled "Show Percentage."
Whether to show battery percentage in the menu bar.
'';
}; };
"com.apple.Safari" = { "com.apple.Safari" = {
@ -125,20 +131,35 @@ in {
</warning> </warning>
''; '';
}; };
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" = "WebKitPreferences.developerExtrasEnabled" = mkNullableOption {
mkNullableOption { type = types.bool;
type = types.bool; description = ''
description = '' Configures the web inspector.
Configures the web inspector.
<warning> <warning>
<para> <para>
Instead of setting this option directly, set Instead of setting this option directly, set
<option>IncludeDevelopMenu</option> instead. <option>IncludeDevelopMenu</option> instead.
</para> </para>
</warning> </warning>
''; '';
}; };
};
"com.apple.Safari.SandboxBroker" = {
ShowDevelopMenu = mkNullableOption {
type = types.bool;
description = ''
Show the "Develop" menu in Safari's menubar.
<warning>
<para>
Instead of setting this option directly, set
<option>"com.apple.Safari".IncludeDevelopMenu</option> instead.
</para>
</warning>
'';
};
}; };
"com.googlecode.iterm2" = { "com.googlecode.iterm2" = {
@ -182,8 +203,11 @@ in {
config = { config = {
"com.apple.Safari" = mkIf (safari.IncludeDevelopMenu != null) { "com.apple.Safari" = mkIf (safari.IncludeDevelopMenu != null) {
WebKitDeveloperExtrasEnabledPreferenceKey = safari.IncludeDevelopMenu; WebKitDeveloperExtrasEnabledPreferenceKey = safari.IncludeDevelopMenu;
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" = "WebKitPreferences.developerExtrasEnabled" = safari.IncludeDevelopMenu;
safari.IncludeDevelopMenu;
}; };
"com.apple.Safari.SandboxBroker" =
mkIf (safari.IncludeDevelopMenu != null) {
ShowDevelopMenu = safari.IncludeDevelopMenu;
};
}; };
} }