1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +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'.
'';
}
{
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)
];
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" ] ''
$VERBOSE_ECHO "Configuring macOS user defaults"
${concatStringsSep "\n" activationCmds}

View file

@ -98,7 +98,13 @@ in {
"com.apple.menuextra.battery".ShowPercent = mkNullableOption {
type = types.enum [ "YES" "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" = {
@ -125,20 +131,35 @@ in {
</warning>
'';
};
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
mkNullableOption {
type = types.bool;
description = ''
Configures the web inspector.
"WebKitPreferences.developerExtrasEnabled" = mkNullableOption {
type = types.bool;
description = ''
Configures the web inspector.
<warning>
<para>
Instead of setting this option directly, set
<option>IncludeDevelopMenu</option> instead.
</para>
</warning>
'';
};
<warning>
<para>
Instead of setting this option directly, set
<option>IncludeDevelopMenu</option> instead.
</para>
</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" = {
@ -182,8 +203,11 @@ in {
config = {
"com.apple.Safari" = mkIf (safari.IncludeDevelopMenu != null) {
WebKitDeveloperExtrasEnabledPreferenceKey = safari.IncludeDevelopMenu;
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
safari.IncludeDevelopMenu;
"WebKitPreferences.developerExtrasEnabled" = safari.IncludeDevelopMenu;
};
"com.apple.Safari.SandboxBroker" =
mkIf (safari.IncludeDevelopMenu != null) {
ShowDevelopMenu = safari.IncludeDevelopMenu;
};
};
}