@@ -197,16 +197,93 @@ in {
197197 } ;
198198
199199 system . defaults . dock . persistent-others = mkOption {
200- type = types . nullOr ( types . listOf ( types . either types . path types . str ) ) ;
200+ type = let
201+ folderType = types . submodule {
202+ options . path = mkOption {
203+ description = "Path to a folder to be added to the dock." ;
204+ type = types . str ;
205+ } ;
206+ options . arrangement = mkOption {
207+ description = "Sort order for files in folder when clicked." ;
208+ type = types . enum [ "name" "date-added" "date-modified" "date-created" "kind" ] ;
209+ default = "name" ;
210+ } ;
211+ options . displayas = mkOption {
212+ description = "How to display the folder before clicked. stack: Stack of file previews. folder: A folder icon" ;
213+ type = types . enum [ "stack" "folder" ] ;
214+ default = "stack" ;
215+ } ;
216+ options . showas = mkOption {
217+ description = "Effect to show files when clicked. fan: fan-out effect, grid: box, list: list" ;
218+ type = types . enum [ "automatic" "fan" "grid" "list" ] ;
219+ default = "automatic" ;
220+ } ;
221+ } ;
222+ taggedType = types . attrTag {
223+ file = mkOption {
224+ description = "A file to be added to the dock." ;
225+ type = types . str ;
226+ } ;
227+ folder = mkOption {
228+ description = "A folder to be added to the dock." ;
229+ type = types . coercedTo types . str ( str : { path = str ; } ) folderType ;
230+ } ;
231+ } ;
232+ simpleType = types . either types . str types . path ;
233+ # Below to NOT break exisiting config
234+ toTagged = _path : let path = builtins . toString _path ; in if strings . hasInfix "." ( last ( splitString "/" path ) ) then { file = path ; } else { folder = path ; } ;
235+ # toTagged = path: { folder = path; }; # or this to be consistent with persistent-apps
236+ in
237+ types . nullOr ( types . listOf ( types . coercedTo simpleType toTagged taggedType ) ) ;
201238 default = null ;
202- example = [ "~/Documents" "~/Downloads" ] ;
239+ example = lib . literalExpression ''
240+ [
241+ ./flake.nix
242+ "/Volumes"
243+ { folder = "/Users/@username@/Downloads"; }
244+ { folder = { path = "/Users/@username@/.emacs.d"; showas = "grid"; }; }
245+ { file = "/Users/@username@/Desktop/this_is_a_file"; }
246+ ]'' ;
203247 description = ''
204- Persistent folders in the dock.
248+ Persistent files, and folders in the dock.
205249 '' ;
206- apply = value :
207- if ! ( isList value )
208- then value
209- 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 ;
250+ apply = let
251+ arrangementMap = {
252+ name = 1 ;
253+ date-added = 2 ;
254+ date-modified = 3 ;
255+ date-created = 4 ;
256+ kind = 5 ;
257+ } ;
258+ displayasMap = {
259+ stack = 0 ;
260+ folder = 1 ;
261+ } ;
262+ showasMap = {
263+ automatic = 0 ;
264+ fan = 1 ;
265+ grid = 2 ;
266+ list = 3 ;
267+ } ;
268+ parseFolder = ( folder :
269+ builtins . mapAttrs ( name : val :
270+ if name == "arrangement" then arrangementMap . ${ val }
271+ else if name == "displayas" then displayasMap . ${ val }
272+ else if name == "showas" then showasMap . ${ val }
273+ else val
274+ ) folder
275+ ) ;
276+ toTile = item : {
277+ tile-data = {
278+ file-data = {
279+ _CFURLString = "file://" + ( if item ? folder then item . folder . path else item . file ) ;
280+ _CFURLStringType = 15 ;
281+ } ;
282+ } // ( if item ? folder then { inherit ( parseFolder item . folder ) arrangement displayas showas ; } else { } ) ;
283+ tile-type = if item ? folder then "directory-tile" else "file-tile" ;
284+ } ;
285+ in
286+ value : if value == null then null else map toTile value ;
210287 } ;
211288
212289 system . defaults . dock . scroll-to-open = mkOption {
@@ -217,6 +294,38 @@ in {
217294 '' ;
218295 } ;
219296
297+ system . defaults . dock . showAppExposeGestureEnabled = mkOption {
298+ type = types . nullOr types . bool ;
299+ default = null ;
300+ description = ''
301+ Whether to enable trackpad gestures (three- or four-finger vertical swipe) to show App Exposé. The default is false. This feature interacts with `system.defaults.trackpad.TrackpadFourFingerVertSwipeGesture` and `system.defaults.trackpad.TrackpadThreeFingerVertSwipeGesture` to determine which gesture triggers App Exposé.
302+ '' ;
303+ } ;
304+
305+ system . defaults . dock . showDesktopGestureEnabled = mkOption {
306+ type = types . nullOr types . bool ;
307+ default = null ;
308+ description = ''
309+ Whether to enable four-finger spread gesture to show the Desktop. The default is false.
310+ '' ;
311+ } ;
312+
313+ system . defaults . dock . showLaunchpadGestureEnabled = mkOption {
314+ type = types . nullOr types . bool ;
315+ default = null ;
316+ description = ''
317+ Whether to enable four-finger pinch gesture to show the Launchpad. The default is false.
318+ '' ;
319+ } ;
320+
321+ system . defaults . dock . showMissionControlGestureEnabled = mkOption {
322+ type = types . nullOr types . bool ;
323+ default = null ;
324+ description = ''
325+ Whether to enable trackpad gestures (three- or four-finger vertical swipe) to show Mission Control. The default is false. This feature interacts with `system.defaults.trackpad.TrackpadFourFingerVertSwipeGesture` and `system.defaults.trackpad.TrackpadThreeFingerVertSwipeGesture` to determine which gesture triggers Mission Control.
326+ '' ;
327+ } ;
328+
220329 system . defaults . dock . show-process-indicators = mkOption {
221330 type = types . nullOr types . bool ;
222331 default = null ;
367476
368477 } ;
369478}
479+
0 commit comments