mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
feat: add dock item property overrides
This allows configuring things like "Sort by", "Display as" and "View content as" by mirroring the exact value observed on a `defaults read`. The existing options and values weren't formalized in the schema as I have no expectations of stability across OS versions.
This commit is contained in:
parent
e2db06ba70
commit
c3058f969a
1 changed files with 20 additions and 5 deletions
|
@ -138,17 +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 = [ "/Users/my_user_name/Documents" "/Users/my_user_name/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 {
|
||||
|
|
Loading…
Reference in a new issue