Skip to content

Commit

Permalink
Add file or directory tile to Dock persistent others
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgpinto committed May 20, 2024
1 parent e1cacc6 commit a1055c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/system/defaults/dock.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ in {
apply = value:
if !(isList value)
then value
else map (folder: { tile-data = { file-data = { _CFURLString = folder; _CFURLStringType = 15; }; }; }) value;
else map (folder: { tile-data = { file-data = { _CFURLString = "file://" + folder; _CFURLStringType = 15; }; }; tile-type = if strings.hasInfix "." (last (splitString "/" folder)) then "file-tile" else "directory-tile"; }) value;
};

system.defaults.dock.show-process-indicators = mkOption {
Expand Down
8 changes: 6 additions & 2 deletions tests/fixtures/system-defaults-write/activate-user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,27 @@ defaults write com.apple.dock 'persistent-others' $'<?xml version="1.0" encoding
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>~/Documents</string>
<string>file://~/Documents</string>
<key>_CFURLStringType</key>
<integer>15</integer>
</dict>
</dict>
<key>tile-type</key>
<string>directory-tile</string>
</dict>
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>~/Downloads</string>
<string>file://~/Downloads/file.txt</string>
<key>_CFURLStringType</key>
<integer>15</integer>
</dict>
</dict>
<key>tile-type</key>
<string>file-tile</string>
</dict>
</array>
</plist>'
Expand Down
2 changes: 1 addition & 1 deletion tests/system-defaults-write.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
system.defaults.dock.autohide-delay = 0.24;
system.defaults.dock.orientation = "left";
system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"];
system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads"];
system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"];
system.defaults.screencapture.location = "/tmp";
system.defaults.screensaver.askForPassword = true;
system.defaults.screensaver.askForPasswordDelay = 5;
Expand Down

0 comments on commit a1055c2

Please sign in to comment.