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,8 +131,7 @@ in {
</warning>
'';
};
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
mkNullableOption {
"WebKitPreferences.developerExtrasEnabled" = mkNullableOption {
type = types.bool;
description = ''
Configures the web inspector.
@ -141,6 +146,22 @@ in {
};
};
"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" = {
AddNewTabAtEndOfTabs = mkNullableEnableOption
"placement of new tabs at the end of the tab bar";
@ -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;
};
};
}