Skip to content

Commit

Permalink
refactor(darwin): restructure defaults and add Dock restart activation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelvanstraten committed Nov 23, 2024
1 parent 8164514 commit 709ba22
Showing 1 changed file with 158 additions and 58 deletions.
216 changes: 158 additions & 58 deletions modules/home-manager/darwin/defaults.nix
Original file line number Diff line number Diff line change
@@ -1,68 +1,168 @@
let
defaults = {
"NSGlobalDomain" = {
# Set a faster keyboard repeat rate
KeyRepeat = 2;
# Set a shorter delay until key repeat
InitialKeyRepeat = 15;
# Enable subpixel font rendering on non-Apple LCDs
AppleFontSmoothing = 2;
};
{
config,
lib,
pkgs,
...
}:
{
home.activation.restartDarwinDock = lib.hm.dag.entryAfter [ "setDarwinDefaults" ] (
lib.optionalString (config.targets.darwin.defaults ? "com.apple.dock") ''
verboseEcho "Restarting macOS Dock"
${lib.getExe pkgs.killall} Dock || true
''
);

"com.apple.dock" = {
autohide = true;
showhidden = true;
show-recents = false;
autohide-time-modifier = 0.7;
# Show indicator lights for open applications in the Dock
show-process-indicators = true;
# Disable most recently used spaces in Dock
mru-spaces = false;
# Enable grouping of application windows in Exposé
expose-group-apps = true;
};
targets.darwin = {
defaults = {
"NSGlobalDomain" = {
# Set a faster keyboard repeat rate
KeyRepeat = 2;
# Set a shorter delay until key repeat
InitialKeyRepeat = 15;
# Enable subpixel font rendering on non-Apple LCDs
AppleFontSmoothing = 2;
};

"com.apple.dock" = {
autohide = true;
showhidden = true;
show-recents = false;
autohide-time-modifier = 0.7;
# Show indicator lights for open applications in the Dock
show-process-indicators = true;
# Disable most recently used spaces in Dock
mru-spaces = false;
# Enable grouping of application windows in Exposé
expose-group-apps = true;
};

"com.apple.AppleMultitouchTrackpad".Clicking = true;
"com.apple.AppleMultitouchTrackpad".Clicking = true;

"com.apple.finder" = {
ShowPathbar = true;
_FXSortFoldersFirst = true;
FXEnableExtensionChangeWarning = false;
ShowExternalHardDrivesOnDesktop = false;
ShowRemovableMediaOnDesktop = false;
ShowMountedServersOnDesktop = false;
ShowHardDrivesOnDesktop = false;
# Show the Home directory as Default folder
NewWindowTarget = "PfHm";
ShowRecentTags = 0;
SidebarDevicesSectionDisclosedState = 1;
StandardViewSettings = {
IconViewSettings = {
arrangeBy = "kind";
gridSpacing = 54;
iconSize = 64;
labelOnBottom = 1;
showIconPreview = 1;
showItemInfo = 0;
textSize = 12;
viewOptionsVersion = 1;
"com.apple.finder" = {
ShowPathbar = true;
_FXSortFoldersFirst = true;
FXEnableExtensionChangeWarning = false;
ShowExternalHardDrivesOnDesktop = false;
ShowRemovableMediaOnDesktop = false;
ShowMountedServersOnDesktop = false;
ShowHardDrivesOnDesktop = false;
# Show the Home directory as Default folder
NewWindowTarget = "PfHm";
ShowRecentTags = 0;
SidebarDevicesSectionDisclosedState = 1;
StandardViewSettings = {
IconViewSettings = {
arrangeBy = "kind";
gridSpacing = 54;
iconSize = 64;
labelOnBottom = 1;
showIconPreview = 1;
showItemInfo = 0;
textSize = 12;
viewOptionsVersion = 1;
};
};
};
};

"com.apple.desktopservices" = {
# Avoid creating .DS_Store files on network volumes
DSDontWriteNetworkStores = true;
};
"com.apple.desktopservices" = {
# Avoid creating .DS_Store files on network volumes
DSDontWriteNetworkStores = true;
};

"com.apple.menuextra.clock" = {
# Make the menu bar clock include seconds
DateFormat = "EEE d MMM HH:mm:ss";
"com.apple.menuextra.clock" = {
# Make the menu bar clock include seconds
DateFormat = "EEE d MMM HH:mm:ss";
};

"com.apple.Spotlight" = {
orderedItems = [
{
enabled = 1;
name = "APPLICATIONS";
}
{
enabled = 1;
name = "MENU_EXPRESSION";
}
{
enabled = 0;
name = "CONTACT";
}
{
enabled = 0;
name = "MENU_CONVERSION";
}
{
enabled = 0;
name = "MENU_DEFINITION";
}
{
enabled = 0;
name = "DOCUMENTS";
}
{
enabled = 0;
name = "EVENT_TODO";
}
{
enabled = 0;
name = "DIRECTORIES";
}
{
enabled = 0;
name = "FONTS";
}
{
enabled = 0;
name = "IMAGES";
}
{
enabled = 0;
name = "MESSAGES";
}
{
enabled = 0;
name = "MOVIES";
}
{
enabled = 0;
name = "MUSIC";
}
{
enabled = 0;
name = "MENU_OTHER";
}
{
enabled = 0;
name = "PDF";
}
{
enabled = 0;
name = "PRESENTATIONS";
}
{
enabled = 0;
name = "MENU_SPOTLIGHT_SUGGESTIONS";
}
{
enabled = 0;
name = "SPREADSHEETS";
}
{
enabled = 0;
name = "SYSTEM_PREFS";
}
{
enabled = 0;
name = "TIPS";
}
{
enabled = 0;
name = "BOOKMARKS";
}
];
};
};
};
in
{
targets.darwin = {
inherit defaults;
};

}

0 comments on commit 709ba22

Please sign in to comment.