mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-16 13:28:16 +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 {
|
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;
|
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 = ''
|
description = ''
|
||||||
Persistent folders in the dock.
|
Persistent folders in the dock.
|
||||||
Note: tilde(`~`) does not get reliably expanded.
|
Note: tilde(`~`) does not get reliably expanded.
|
||||||
'';
|
'';
|
||||||
apply = value:
|
apply = value:
|
||||||
if !(isList value)
|
if !(isList value) then value else
|
||||||
then value
|
let
|
||||||
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;
|
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 {
|
system.defaults.dock.show-process-indicators = mkOption {
|
||||||
|
|
Loading…
Add table
Reference in a new issue