1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

Merge pull request #357 from eraserhd/magic-mouse

defaults: magic mouse option
This commit is contained in:
Daiderd Jordan 2021-09-14 18:52:46 +02:00 committed by GitHub
commit 39af16ede5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View file

@ -16,6 +16,7 @@
./system/defaults/screencapture.nix
./system/defaults/alf.nix
./system/defaults/loginwindow.nix
./system/defaults/magicmouse.nix
./system/defaults/smb.nix
./system/defaults/SoftwareUpdate.nix
./system/defaults/spaces.nix

View file

@ -34,6 +34,8 @@ let
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;
mkIfAttrs = list: mkIf (any (attrs: attrs != {}) list);
in
@ -52,7 +54,7 @@ in
'';
system.activationScripts.userDefaults.text = mkIfAttrs
[ NSGlobalDomain GlobalPreferences LaunchServices dock finder screencapture spaces trackpad trackpadBluetooth ]
[ NSGlobalDomain GlobalPreferences LaunchServices dock finder screencapture spaces trackpad trackpadBluetooth magicmouse magicmouseBluetooth ]
''
# Set defaults
echo >&2 "user defaults..."
@ -66,6 +68,8 @@ in
${concatStringsSep "\n" spaces}
${concatStringsSep "\n" trackpad}
${concatStringsSep "\n" trackpadBluetooth}
${concatStringsSep "\n" magicmouse}
${concatStringsSep "\n" magicmouseBluetooth}
'';
};

View file

@ -0,0 +1,21 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.magicmouse.MouseButtonMode = mkOption {
type = types.nullOr (types.enum [
"OneButton"
"TwoButton"
]);
default = null;
description = ''
"OneButton": any tap is a left click. "TwoButton": allow left-
and right-clicking.
'';
};
};
}