Skip to content

Commit

Permalink
dock: allow setting tile-types
Browse files Browse the repository at this point in the history
You can create spacer tiles in the dock by passing empty tile-data with
specific tile-types
  • Loading branch information
khaneliman committed Nov 21, 2024
1 parent 61cee20 commit 9c4bf62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion modules/system/defaults/dock.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,16 @@ in {
Persistent applications in the dock.
'';
apply = value:
let
tileTypes = ["spacer-tile" "small-spacer-tile"];
in
if !(isList value)
then value
else map (app: { tile-data = { file-data = { _CFURLString = app; _CFURLStringType = 0; }; }; }) value;
else map (app:
if elem app tileTypes
then { tile-data = {}; tile-type = app; }
else { tile-data = { file-data = { _CFURLString = app; _CFURLStringType = 0; }; }; }
) value;
};

system.defaults.dock.persistent-others = mkOption {
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 @@ -49,7 +49,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.dock.persistent-apps = ["MyApp.app" "Cool.app" "small-spacer-tile" "spacer-tile"];
system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"];
system.defaults.dock.scroll-to-open = false;
system.defaults.finder.AppleShowAllFiles = true;
Expand Down

0 comments on commit 9c4bf62

Please sign in to comment.