1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-09-11 12:49:18 +03:00

Merge pull request #155 from toonn/defaults-write-GlobalPreferences

Add defaults write for the alert sound
This commit is contained in:
Daiderd Jordan 2019-09-01 09:58:01 +02:00 committed by GitHub
commit be7f25b3f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 1 deletions

View File

@ -10,6 +10,7 @@
./system/defaults-write.nix
./system/defaults/LaunchServices.nix
./system/defaults/NSGlobalDomain.nix
./system/defaults/GlobalPreferences.nix
./system/defaults/dock.nix
./system/defaults/finder.nix
./system/defaults/screencapture.nix

View File

@ -22,6 +22,7 @@ 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;
@ -44,12 +45,13 @@ in
'';
system.activationScripts.userDefaults.text = mkIfAttrs
[ NSGlobalDomain LaunchServices dock finder screencapture trackpad trackpadBluetooth ]
[ NSGlobalDomain GlobalPreferences LaunchServices dock finder screencapture trackpad trackpadBluetooth ]
''
# Set defaults
echo >&2 "user defaults..."
${concatStringsSep "\n" NSGlobalDomain}
${concatStringsSep "\n" GlobalPreferences}
${concatStringsSep "\n" LaunchServices}
${concatStringsSep "\n" dock}
${concatStringsSep "\n" finder}

View File

@ -0,0 +1,20 @@
{ config, lib, ... }:
with lib;
{
options = {
system.defaults.".GlobalPreferences"."com.apple.sound.beep.sound" =
mkOption {
type = types.nullOr (types.path);
default = null;
description = ''
Sets the system-wide alert sound. Found under "Sound Effects" in the
"Sound" section of "System Preferences". Look in
"/System/Library/Sounds" for possible candidates.
'';
};
};
}

View File

@ -31,6 +31,7 @@
system.defaults.NSGlobalDomain."com.apple.springing.enabled" = true;
system.defaults.NSGlobalDomain."com.apple.springing.delay" = "0.0";
system.defaults.NSGlobalDomain."com.apple.swipescrolldirection" = true;
system.defaults.".GlobalPreferences"."com.apple.sound.beep.sound" = "/System/Library/Sounds/Funk.aiff";
system.defaults.dock.autohide-delay = "0.24";
system.defaults.dock.orientation = "left";
system.defaults.screencapture.location = "/tmp";
@ -73,6 +74,7 @@
grep "defaults write -g 'com.apple.springing.enabled' -bool YES" ${config.out}/activate-user
grep "defaults write -g 'com.apple.springing.delay' -float 0.0" ${config.out}/activate-user
grep "defaults write -g 'com.apple.swipescrolldirection' -bool YES" ${config.out}/activate-user
grep "defaults write .GlobalPreferences 'com.apple.sound.beep.sound' -string '/System/Library/Sounds/Funk.aiff'" ${config.out}/activate-user
grep "defaults write com.apple.dock 'autohide-delay' -float 0.24" ${config.out}/activate-user
grep "defaults write com.apple.dock 'orientation' -string 'left'" ${config.out}/activate-user
grep "defaults write com.apple.screencapture 'location' -string '/tmp'" ${config.out}/activate-user