1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

Add defaults write for the alert sound

Found in `System Preferences`->`Sound`->`Sound Effects`, the default is `Funk`.
This commit is contained in:
toonn 2019-08-19 16:02:59 +02:00
parent ef3d6e4354
commit 88d27c62d5
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

@ -30,6 +30,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";
@ -71,6 +72,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