summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2022-01-17 21:42:43 +0100
committerGitHub <noreply@github.com>2022-01-17 21:42:43 +0100
commitf22e870a2e865e2bdb7e14d0d0e01dabd4cfb82d (patch)
treef880e1e63a55bda941f94fbba8f3d01ea69e17d1 /modules
parent13d129434dd3ed179ae2f515ebd0dbd3a82a9be4 (diff)
parent1cf57052834731a8cabf644032e9147606ac0ed1 (diff)
Merge pull request #414 from montchr/feature/system-defaults-universalaccess
defaults: add options for common defaults in the `com.apple.universalaccess` domain
Diffstat (limited to 'modules')
-rw-r--r--modules/module-list.nix1
-rw-r--r--modules/system/defaults-write.nix48
-rw-r--r--modules/system/defaults/universalaccess.nix38
3 files changed, 75 insertions, 12 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix
index e7fd2af..30a83b9 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -21,6 +21,7 @@
./system/defaults/SoftwareUpdate.nix
./system/defaults/spaces.nix
./system/defaults/trackpad.nix
+ ./system/defaults/universalaccess.nix
./system/etc.nix
./system/keyboard.nix
./system/launchd.nix
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix
index 8342984..e58c3ac 100644
--- a/modules/system/defaults-write.nix
+++ b/modules/system/defaults-write.nix
@@ -21,29 +21,38 @@ let
defaultsToList = domain: attrs: mapAttrsToList (writeDefault domain) (filterAttrs (n: v: v != null) attrs);
- NSGlobalDomain = defaultsToList "-g" cfg.NSGlobalDomain;
- GlobalPreferences = defaultsToList ".GlobalPreferences" cfg.".GlobalPreferences";
- LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices;
- dock = defaultsToList "com.apple.dock" cfg.dock;
- finder = defaultsToList "com.apple.finder" cfg.finder;
+ # defaults
alf = defaultsToList "/Library/Preferences/com.apple.alf" cfg.alf;
loginwindow = defaultsToList "/Library/Preferences/com.apple.loginwindow" cfg.loginwindow;
smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb;
SoftwareUpdate = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.SoftwareUpdate" cfg.SoftwareUpdate;
+
+ # userDefaults
+ GlobalPreferences = defaultsToList ".GlobalPreferences" cfg.".GlobalPreferences";
+ LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices;
+ NSGlobalDomain = defaultsToList "-g" cfg.NSGlobalDomain;
+ dock = defaultsToList "com.apple.dock" cfg.dock;
+ finder = defaultsToList "com.apple.finder" cfg.finder;
+ magicmouse = defaultsToList "com.apple.AppleMultitouchMouse" cfg.magicmouse;
+ magicmouseBluetooth = defaultsToList "com.apple.driver.AppleMultitouchMouse.mouse" cfg.magicmouse;
screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture;
spaces = defaultsToList "com.apple.spaces" cfg.spaces;
trackpad = defaultsToList "com.apple.AppleMultitouchTrackpad" cfg.trackpad;
trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad;
- magicmouse = defaultsToList "com.apple.AppleMultitouchMouse" cfg.magicmouse;
- magicmouseBluetooth = defaultsToList "com.apple.driver.AppleMultitouchMouse.mouse" cfg.magicmouse;
+ universalaccess = defaultsToList "com.apple.universalaccess" cfg.universalaccess;
- mkIfAttrs = list: mkIf (any (attrs: attrs != {}) list);
+ mkIfAttrs = list: mkIf (any (attrs: attrs != { }) list);
in
{
config = {
- system.activationScripts.defaults.text = mkIfAttrs [ alf loginwindow smb SoftwareUpdate ]
+ system.activationScripts.defaults.text = mkIfAttrs [
+ alf
+ loginwindow
+ smb
+ SoftwareUpdate
+ ]
''
# Set defaults
echo >&2 "system defaults..."
@@ -54,22 +63,37 @@ in
'';
system.activationScripts.userDefaults.text = mkIfAttrs
- [ NSGlobalDomain GlobalPreferences LaunchServices dock finder screencapture spaces trackpad trackpadBluetooth magicmouse magicmouseBluetooth ]
+ [
+ GlobalPreferences
+ LaunchServices
+ NSGlobalDomain
+ dock
+ finder
+ magicmouse
+ magicmouseBluetooth
+ screencapture
+ spaces
+ trackpad
+ trackpadBluetooth
+ universalaccess
+ ]
''
# Set defaults
echo >&2 "user defaults..."
${concatStringsSep "\n" NSGlobalDomain}
+
${concatStringsSep "\n" GlobalPreferences}
${concatStringsSep "\n" LaunchServices}
${concatStringsSep "\n" dock}
${concatStringsSep "\n" finder}
+ ${concatStringsSep "\n" magicmouse}
+ ${concatStringsSep "\n" magicmouseBluetooth}
${concatStringsSep "\n" screencapture}
${concatStringsSep "\n" spaces}
${concatStringsSep "\n" trackpad}
${concatStringsSep "\n" trackpadBluetooth}
- ${concatStringsSep "\n" magicmouse}
- ${concatStringsSep "\n" magicmouseBluetooth}
+ ${concatStringsSep "\n" universalaccess}
'';
};
diff --git a/modules/system/defaults/universalaccess.nix b/modules/system/defaults/universalaccess.nix
new file mode 100644
index 0000000..85cae54
--- /dev/null
+++ b/modules/system/defaults/universalaccess.nix
@@ -0,0 +1,38 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+ options = {
+
+ system.defaults.universalaccess.reduceTransparency = mkOption {
+ type = types.nullOr types.bool;
+ default = null;
+ description = ''
+ Disable transparency in the menu bar and elsewhere.
+ Requires macOS Yosemite or later.
+ The default is false.
+ '';
+ };
+
+ system.defaults.universalaccess.closeViewScrollWheelToggle = mkOption {
+ type = types.nullOr types.bool;
+ default = null;
+ description = ''
+ Use scroll gesture with the Ctrl (^) modifier key to zoom.
+ The default is false.
+ '';
+ };
+
+ system.defaults.universalaccess.closeViewZoomFollowsFocus = mkOption {
+ type = types.nullOr types.bool;
+ default = null;
+ description = ''
+ Follow the keyboard focus while zoomed in.
+ Without setting `closeViewScrollWheelToggle` this has no effect.
+ The default is false.
+ '';
+ };
+
+ };
+}