diff --git a/modules/system/defaults/dock.nix b/modules/system/defaults/dock.nix index bba0afb..8eaf5ca 100644 --- a/modules/system/defaults/dock.nix +++ b/modules/system/defaults/dock.nix @@ -134,10 +134,14 @@ in { description = '' Persistent applications in the dock. ''; - apply = value: - if !(isList value) - then value - else map (app: { tile-data = { file-data = { _CFURLString = app; _CFURLStringType = 0; }; }; }) value; + apply = + let + tileTypes = ["spacer-tile" "small-spacer-tile"]; + toSpecialTile = type: { tile-data = {}; tile-type = type; }; + toAppTile = cfurl: { tile-data = { file-data = { _CFURLString = cfurl; _CFURLStringType = 0; }; }; }; + toTile = s: if elem s tileTypes then toSpecialTile s else toAppTile s; + in + value: if isList value then map toTile value else value; }; system.defaults.dock.persistent-others = mkOption { diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index eda3753..aa60500 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -273,6 +273,22 @@ defaults write com.apple.dock 'persistent-apps' $' + + tile-data + + + + tile-type + small-spacer-tile + + + tile-data + + + + tile-type + spacer-tile + ' defaults write com.apple.dock 'persistent-others' $' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 0b8bc03..3f69c0b 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -50,7 +50,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;