Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dock item property overrides #1078

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions modules/system/defaults/dock.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -297,6 +313,5 @@ in {
* `14`: Quick Note
'';
};

};
};
}