diff --git a/modules/system/defaults/dock.nix b/modules/system/defaults/dock.nix index 5c4a47096..50608e131 100644 --- a/modules/system/defaults/dock.nix +++ b/modules/system/defaults/dock.nix @@ -5,7 +5,8 @@ with lib; let # Should only be used with options that previously used floats defined as strings. inherit (config.lib.defaults.types) floatWithDeprecationError; -in { +in +{ options = { system.defaults.dock.appswitcher-all-displays = mkOption { @@ -137,16 +138,32 @@ in { }; system.defaults.dock.persistent-others = mkOption { - type = types.nullOr (types.listOf (types.either types.path types.str)); + type = types.nullOr (types.listOf (types.oneOf [ types.path types.str types.attrs ])); default = null; - example = [ "~/Documents" "~/Downloads" ]; + example = [ + "/Users/my_user_name/Documents" + { name = "/Users/my_user_name/Downloads"; tile-data = { arrangement = 2; showas = 1; }; } + ]; description = '' Persistent folders in the dock. + Note: tilde(`~`) does not get reliably expanded. ''; apply = value: - if !(isList value) - then 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; + if !(isList value) then value else + let + pathToConfig = (path: { + tile-data = { file-data = { _CFURLString = "file://" + path; _CFURLStringType = 15; }; }; + tile-type = if strings.hasInfix "." (last (splitString "/" path)) then "file-tile" else "directory-tile"; + }); + in + map + (folder: + if (isString folder) + then pathToConfig folder + else + (lib.recursiveUpdate (builtins.removeAttrs folder [ "name" ]) + (pathToConfig folder.name))) + value; }; system.defaults.dock.show-process-indicators = mkOption { @@ -212,7 +229,6 @@ in { Magnified icon size on hover. The default is 16. ''; }; - system.defaults.dock.wvous-tl-corner = mkOption { type = types.nullOr types.ints.positive; @@ -297,6 +313,5 @@ in { * `14`: Quick Note ''; }; - - }; + }; }