summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/module-list.nix1
-rw-r--r--modules/system/defaults-write.nix3
-rw-r--r--modules/system/defaults/hitoolbox.nix29
-rw-r--r--tests/fixtures/system-defaults-write/activate-user.txt5
-rw-r--r--tests/system-defaults-write.nix1
5 files changed, 39 insertions, 0 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix
index effdff7..5477fad 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -21,6 +21,7 @@
./system/defaults/clock.nix
./system/defaults/dock.nix
./system/defaults/finder.nix
+ ./system/defaults/hitoolbox.nix
./system/defaults/screencapture.nix
./system/defaults/screensaver.nix
./system/defaults/alf.nix
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix
index e7f2c03..7af972d 100644
--- a/modules/system/defaults-write.nix
+++ b/modules/system/defaults-write.nix
@@ -23,6 +23,7 @@ let
menuExtraClock = defaultsToList "com.apple.menuextra.clock" cfg.menuExtraClock;
dock = defaultsToList "com.apple.dock" cfg.dock;
finder = defaultsToList "com.apple.finder" cfg.finder;
+ hitoolbox = defaultsToList "com.apple.HIToolbox" cfg.hitoolbox;
magicmouse = defaultsToList "com.apple.AppleMultitouchMouse" cfg.magicmouse;
magicmouseBluetooth = defaultsToList "com.apple.driver.AppleMultitouchMouse.mouse" cfg.magicmouse;
screencapture = defaultsToList "com.apple.screencapture" cfg.screencapture;
@@ -76,6 +77,7 @@ in
menuExtraClock
dock
finder
+ hitoolbox
magicmouse
magicmouseBluetooth
screencapture
@@ -99,6 +101,7 @@ in
${concatStringsSep "\n" menuExtraClock}
${concatStringsSep "\n" dock}
${concatStringsSep "\n" finder}
+ ${concatStringsSep "\n" hitoolbox}
${concatStringsSep "\n" magicmouse}
${concatStringsSep "\n" magicmouseBluetooth}
${concatStringsSep "\n" screencapture}
diff --git a/modules/system/defaults/hitoolbox.nix b/modules/system/defaults/hitoolbox.nix
new file mode 100644
index 0000000..c2e336b
--- /dev/null
+++ b/modules/system/defaults/hitoolbox.nix
@@ -0,0 +1,29 @@
+{ lib, ... }:
+
+{
+ options = {
+
+ system.defaults.hitoolbox.AppleFnUsageType = lib.mkOption {
+ type = lib.types.nullOr (lib.types.enum [
+ "Do Nothing"
+ "Change Input Source"
+ "Show Emoji & Symbols"
+ "Start Dictation"
+ ]);
+ apply = key: if key == null then null else {
+ "Do Nothing" = 0;
+ "Change Input Source" = 1;
+ "Show Emoji & Symbols" = 2;
+ "Start Dictation" = 3;
+ }.${key};
+ default = null;
+ description = ''
+ Chooses what happens when you press the Fn key on the keyboard. A restart is required for
+ this setting to take effect.
+
+ The default is unset ("Show Emoji & Symbols").
+ '';
+ };
+
+ };
+}
diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt
index f3e01a6..34ff728 100644
--- a/tests/fixtures/system-defaults-write/activate-user.txt
+++ b/tests/fixtures/system-defaults-write/activate-user.txt
@@ -354,6 +354,11 @@ defaults write com.apple.finder '_FXSortFoldersFirst' $'<?xml version="1.0" enco
<plist version="1.0">
<true/>
</plist>'
+defaults write com.apple.HIToolbox 'AppleFnUsageType' $'<?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>2</integer>
+</plist>'
defaults write com.apple.screencapture 'location' $'<?xml version="1.0" encoding="UTF-8"?>
diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix
index eae6199..d5e0d08 100644
--- a/tests/system-defaults-write.nix
+++ b/tests/system-defaults-write.nix
@@ -61,6 +61,7 @@
system.defaults.finder._FXShowPosixPathInTitle = true;
system.defaults.finder._FXSortFoldersFirst = true;
system.defaults.finder.FXEnableExtensionChangeWarning = false;
+ system.defaults.hitoolbox.AppleFnUsageType = "Show Emoji & Symbols";
system.defaults.screencapture.location = "/tmp";
system.defaults.screensaver.askForPassword = true;
system.defaults.screensaver.askForPasswordDelay = 5;