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

Allow more configuration for persistent-others in dock #1004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szethh
Copy link

@szethh szethh commented Jul 12, 2024

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:

  1. We leave the behavior as-is (ie just pass objects through), and document each option and their possible values/defaults.
  2. 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 and tile-type.

@szethh
Copy link
Author

szethh commented Jul 28, 2024

@emilazy hi, pinging maintainers to ask whether any changes are needed to this? or any clarification?
i see from the reactions to the pr some people might be interested in this feature as well :)

@emilazy
Copy link
Collaborator

emilazy commented Jul 28, 2024

Sorry for not getting to this earlier. Can system.defaults.CustomUserPreferences not be used for this advanced case? I guess maybe not because it wouldn’t let you mix normal paths with the fancier stuff? In general it feels a bit awkward to expose an undocumented/probably not entirely stable defaults structure without any type‐checking as a supported interface, but that’s somewhat of a pervasive problem already. The commit message should be e.g. system/defaults/dock: support more configuration for persistent-others.

@szethh
Copy link
Author

szethh commented Aug 3, 2024

I agree that having this without typechecking is a bit hacky. I tried setting that up with the submodule type but I must be missing something because I could not get it to work :/

maybe someone with more nix knowhow can take a shot at it, for now i'm just updating the commit message as requested and leaving it without typechecks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants