feat: customize keyrepeat & other preferences - macOS

This commit is contained in:
Ryan Yin
2023-07-14 14:40:11 +08:00
parent df63bce926
commit 040d8a210c

View File

@@ -10,6 +10,14 @@
##########################################################################
system = {
# activationScripts are executed every time you boot the system or run `nixos-rebuild`.
activationScripts.postUserActivation.text = ''
# activateSettings -u will reload the settings from the database and apply them to the current session,
# so we do not need to logout and login again to make the changes take effect.
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';
defaults = {
# customize dock
dock = {
@@ -51,8 +59,10 @@
# If you press and hold certain keyboard keys when in a text area, the keys character begins to repeat.
# This is very useful for vim users, they use `hjkl` to move cursor.
InitialKeyRepeat = 20; # sets how long it takes before it starts repeating.
KeyRepeat = 10; # sets how fast it repeats once it starts.
# sets how long it takes before it starts repeating.
InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms)
# sets how fast it repeats once it starts.
KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms)
NSAutomaticCapitalizationEnabled = false; # disable auto capitalization(自动大写)
NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution(智能破折号替换)
@@ -63,6 +73,42 @@
NSNavPanelExpandedStateForSaveMode2 = true;
};
# customize settings that not supported by nix-darwin directly
CustomUserPreferences = {
NSGlobalDomain = {
# Add a context menu item for showing the Web Inspector in web views
WebKitDeveloperExtras = true;
};
"com.apple.finder" = {
ShowExternalHardDrivesOnDesktop = true;
ShowHardDrivesOnDesktop = true;
ShowMountedServersOnDesktop = true;
ShowRemovableMediaOnDesktop = true;
_FXSortFoldersFirst = true;
# When performing a search, search the current folder by default
FXDefaultSearchScope = "SCcf";
};
"com.apple.desktopservices" = {
# Avoid creating .DS_Store files on network or USB volumes
DSDontWriteNetworkStores = true;
DSDontWriteUSBStores = true;
};
"com.apple.screensaver" = {
# Require password immediately after sleep or screen saver begins
askForPassword = 1;
askForPasswordDelay = 0;
};
"com.apple.screencapture" = {
location = "~/Desktop";
type = "png";
};
"com.apple.AdLib" = {
allowApplePersonalizedAdvertising = false;
};
# Prevent Photos from opening automatically when devices are plugged in
"com.apple.ImageCapture".disableHotPlug = true;
};
loginwindow = {
GuestEnabled = false; # disable guest user
SHOWFULLNAME = true; # show full name in login window