diff --git a/modules/system/defaults/dock.nix b/modules/system/defaults/dock.nix index 27772ca2..b48486e9 100644 --- a/modules/system/defaults/dock.nix +++ b/modules/system/defaults/dock.nix @@ -136,6 +136,19 @@ in { else map (app: { tile-data = { file-data = { _CFURLString = app; _CFURLStringType = 0; }; }; }) value; }; + system.defaults.dock.persistent-others = mkOption { + type = types.nullOr (types.listOf (types.either types.path types.str)); + default = null; + example = [ "~/Documents" "~/Downloads" ]; + description = lib.mdDoc '' + Persistent folders in the dock. + ''; + apply = value: + if !(isList value) + then value + else map (folder: { tile-data = { file-data = { _CFURLString = folder; _CFURLStringType = 15; }; }; }) value; + }; + system.defaults.dock.show-process-indicators = mkOption { type = types.nullOr types.bool; default = null; diff --git a/tests/fixtures/system-defaults-write/activate-user.txt b/tests/fixtures/system-defaults-write/activate-user.txt index 1021ab38..5fa59528 100644 --- a/tests/fixtures/system-defaults-write/activate-user.txt +++ b/tests/fixtures/system-defaults-write/activate-user.txt @@ -255,6 +255,36 @@ defaults write com.apple.dock 'persistent-apps' $' ' +defaults write com.apple.dock 'persistent-others' $' + + + + + tile-data + + file-data + + _CFURLString + ~/Documents + _CFURLStringType + 15 + + + + + tile-data + + file-data + + _CFURLString + ~/Downloads + _CFURLStringType + 15 + + + + +' diff --git a/tests/system-defaults-write.nix b/tests/system-defaults-write.nix index 9840298b..e17d9502 100644 --- a/tests/system-defaults-write.nix +++ b/tests/system-defaults-write.nix @@ -47,6 +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.screencapture.location = "/tmp"; system.defaults.screensaver.askForPassword = true; system.defaults.screensaver.askForPasswordDelay = 5;