1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

dock: allow setting tile-types

You can create spacer tiles in the dock by passing empty tile-data with
specific tile-types
This commit is contained in:
Austin Horstman 2024-11-21 15:18:31 -06:00
parent a35b08d09e
commit c5e82869eb
No known key found for this signature in database
3 changed files with 25 additions and 5 deletions

View file

@ -134,10 +134,14 @@ in {
description = '' description = ''
Persistent applications in the dock. Persistent applications in the dock.
''; '';
apply = value: apply =
if !(isList value) let
then value tileTypes = ["spacer-tile" "small-spacer-tile"];
else map (app: { tile-data = { file-data = { _CFURLString = app; _CFURLStringType = 0; }; }; }) value; toSpecialTile = type: { tile-data = {}; tile-type = type; };
toAppTile = cfurl: { tile-data = { file-data = { _CFURLString = cfurl; _CFURLStringType = 0; }; }; };
toTile = s: if elem s tileTypes then toSpecialTile s else toAppTile s;
in
value: if isList value then map toTile value else value;
}; };
system.defaults.dock.persistent-others = mkOption { system.defaults.dock.persistent-others = mkOption {

View file

@ -273,6 +273,22 @@ defaults write com.apple.dock 'persistent-apps' $'<?xml version="1.0" encoding="
</dict> </dict>
</dict> </dict>
</dict> </dict>
<dict>
<key>tile-data</key>
<dict>
</dict>
<key>tile-type</key>
<string>small-spacer-tile</string>
</dict>
<dict>
<key>tile-data</key>
<dict>
</dict>
<key>tile-type</key>
<string>spacer-tile</string>
</dict>
</array> </array>
</plist>' </plist>'
defaults write com.apple.dock 'persistent-others' $'<?xml version="1.0" encoding="UTF-8"?> defaults write com.apple.dock 'persistent-others' $'<?xml version="1.0" encoding="UTF-8"?>

View file

@ -50,7 +50,7 @@
system.defaults.dock.appswitcher-all-displays = false; system.defaults.dock.appswitcher-all-displays = false;
system.defaults.dock.autohide-delay = 0.24; system.defaults.dock.autohide-delay = 0.24;
system.defaults.dock.orientation = "left"; system.defaults.dock.orientation = "left";
system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app"]; system.defaults.dock.persistent-apps = ["MyApp.app" "Cool.app" "small-spacer-tile" "spacer-tile"];
system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"]; system.defaults.dock.persistent-others = ["~/Documents" "~/Downloads/file.txt"];
system.defaults.dock.scroll-to-open = false; system.defaults.dock.scroll-to-open = false;
system.defaults.finder.AppleShowAllFiles = true; system.defaults.finder.AppleShowAllFiles = true;