nix-darwin
nix-darwin copied to clipboard
Allow more configuration for persistent-others in dock
See #982, currently system.defaults.dock.persistent-others
can only take paths to folders to display in the dock.
From each path, a more complex object is constructed, with the actual settings for the folder. This PR is to allow users to directly define that object.
This allows users to define the sorting criterion, and multiple other display changes.
You would use it like so:
# darwin.nix
system.defaults.dock.persistent-others = [
{
"tile-data" = {
arrangement = 3; # 1 = name, 2 = date added, 3 = date modified, 4 = Date Created, 5 = kind; default is 1
displayas = 0; # 0 = stack, 1 = folder; default is 0
"file-data" = {
"_CFURLString" = "file:///Users/szeth/Downloads"; # the path to the folder
"_CFURLStringType" = 15;
};
#"file-label" = "Downloads"; # default is the name of the directory
showas = 1; # 1 = fan, 2 = grid, 3 = list, 4 = automatic; default is 4
};
"tile-type" = "directory-tile"; # either file-tile or directory-tile
}
];
(this works fine on my dock)
The changes I made simply widen the type (to accept types.attrsOf types.anything
as well), and then simply pass the object through.
Now my initial implementation is very simple, and since I'm quite new to Nix and to this repo, I don't know what the best way to approach this is:
- We leave the behavior as-is (ie just pass objects through), and document each option and their possible values/defaults.
- We create a submodule, to have proper type checking. No idea how to do this properly.
Note that there are some properties that should still be generated for you, like
_CFURLStringType
andtile-type
.