Skip to content

Commit

Permalink
Merge pull request #898 from dfrankland/dock-persistent-apps
Browse files Browse the repository at this point in the history
Add support for persistent-apps in dock
  • Loading branch information
Enzime authored Mar 4, 2024
2 parents e7d7a7f + 5c65cfb commit daa0360
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/system/defaults/dock.nix
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ in {
'';
};

system.defaults.dock.persistent-apps = mkOption {
type = types.nullOr (types.listOf (types.either types.path types.str));
default = null;
example = [ "/Applications/Safari.app" "/System/Applications/Utilities/Terminal.app" ];
description = lib.mdDoc ''
Persistent applications in the dock.
'';
apply = value:
if !(isList value)
then value
else map (app: { tile-data = { file-data = { _CFURLString = app; _CFURLStringType = 0; }; }; }) value;
};

system.defaults.dock.show-process-indicators = mkOption {
type = types.nullOr types.bool;
default = null;
Expand Down
30 changes: 30 additions & 0 deletions tests/fixtures/system-defaults-write/activate-user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,36 @@ defaults write com.apple.dock 'orientation' $'<?xml version="1.0" encoding="UTF-
<plist version="1.0">
<string>left</string>
</plist>'
defaults write com.apple.dock 'persistent-apps' $'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>MyApp.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
</dict>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>Cool.app</string>
<key>_CFURLStringType</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</array>
</plist>'



Expand Down
1 change: 1 addition & 0 deletions tests/system-defaults-write.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
system.defaults.dock.appswitcher-all-displays = false;
system.defaults.dock.autohide-delay = 0.24;
system.defaults.dock.orientation = "left";
system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"];
system.defaults.screencapture.location = "/tmp";
system.defaults.screensaver.askForPassword = true;
system.defaults.screensaver.askForPasswordDelay = 5;
Expand Down

0 comments on commit daa0360

Please sign in to comment.