aboutsummaryrefslogtreecommitdiff
path: root/.config/cow/cow.conf
blob: d1aa29a0f860fdfb562fb4430460f3e15af61e25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
# cow window manager configuration
#
# cow(1) reads this file at startup.  The same commands can be sent to a
# running instance with moocow(1).

# -----------------------------------------------------------------------------
# General behaviour
# -----------------------------------------------------------------------------

# Keyboard moves and resizes use this many pixels per step.
set step 5

# Keys which repeat while held during menu navigation.  Use "none" to
# disable menu key repetition.
set menu.repeat_keys Up,Down

# Focus policy: "click" focuses on click; "sloppy" focuses as the pointer
# enters a window.  Sloppy focus does not focus the root window.
set focus sloppy

# Snap a moving window when it comes within this many pixels of an edge.
set snap_distance 12

# New-window placement: "cascade", "centre" (or "center"), "empty", or
# "undermouse".  Empty chooses the first available space and falls back to
# cascade when no unobstructed position can contain the complete frame.
set placement undermouse

# Raise a window when it receives focus.  Set false to preserve stacking.
set raise_on_focus true

# Cursor theme and size default to XCURSOR_THEME and XCURSOR_SIZE when those
# variables are set, otherwise "default" and 24.  Changes apply immediately
# to River and CoW-owned cursors, and to applications subsequently launched
# by CoW.
# set cursor.theme Adwaita
# set cursor.size 48

# Hide the pointer after this many milliseconds without input.  Zero disables
# pointer hiding.
set cursor.hide_timeout 4000

# -----------------------------------------------------------------------------
# Outputs and backgrounds
# -----------------------------------------------------------------------------

# Reserve space which ordinary windows will not cover.  The four keys are
# reserved.top, reserved.right, reserved.bottom, and reserved.left.  Match the
# value to your panel's size, or set it to 0 when no reservation is needed.
#
# Note that applications such as waybar are already in a reserved space, which
# CoW honours, so there's no need to set this option.
#
set reserved.top 55
set reserved.left 10
set reserved.right 10
set reserved.bottom 10

# The base background colour is shared by all outputs.
# Colours accept 0xRRGGBB or 0xRRGGBBAA; the final byte is opacity.
set output.colour.background 0x282828

# Background images may be PNG, SVG, or XPM.  They tile over the base colour,
# so transparent images can be combined with any colour.  A suffix selects a
# particular output; "none" disables the image on that output.
#
# set output.image.background cow-default-wallpaper.png
# set output.colour.background.DP-1 0x828282
# set output.image.background.DP-1 ~/pictures/wallpaper-tile.png
# set output.image.background.eDP-1 none

# -----------------------------------------------------------------------------
# Desks and virtual pages
# -----------------------------------------------------------------------------

# Desk policy: "global" makes every output show the same desk; "per-output"
# lets each output switch desks independently.  The built-in default is global.
set desktop-configuration per-output

# Each desk can be larger than the output.  A 1x1 grid disables paging; this
# 3x3 example is navigated with scroll bindings or cursor-at-edge scrolling.
set desktop_size 1 1

# cow creates ten desks named 0 through 9.  These commands show how to choose
# a different count or assign names (cowbar -n displays names).
# set desks.count 5
# desk-name 0 main

# Page changes are instantaneous by default.  Enable both settings for a
# smooth transition and choose its duration in milliseconds.
# set page_scroll_animate true
# set page_scroll_ms 200

# With edge scrolling enabled, holding the pointer at a usable screen edge
# changes page after this delay.  Set edge_scroll false if bindings alone are
# preferable.  Edges at the boundary of the page grid do nothing.
set edge_scroll true
set edge_scroll_delay_ms 300

# At an edge-scrolled page boundary, a settled window belongs to the page
# containing its content origin.  Use "overlap" to keep every intersecting
# part visible when a window spans that boundary.
set page_visibility origin

# Keep interactive moves within the output under the pointer.  Use
# "all_outputs" to move freely within the bounding area of every output, or
# "none" to disable boundary clamping.  Edge snapping remains enabled.
set clamp_mode output

# -----------------------------------------------------------------------------
# Default window decoration
# -----------------------------------------------------------------------------

# A decor profile is defined one property at a time, then applied with
# `decor -a`.  Applying it globally also makes it the profile used by future
# windows.  Keep baseline settings in one profile: rules should normally be
# reserved for deliberate per-window or per-desk overlays.

# Frame geometry and titlebar.
decor -d default border.width 5
decor -d default border.style fvwm
# decor -d default border.corner_length 20
decor -d default titlebar.enabled true
decor -d default titlebar.height 22
# decor -d default titlebar.position top
decor -d default titlebar.font 'GoMono Nerd Font Mono 10'

# Colours use 0xRRGGBB.  A general edge value is inherited by each individual
# edge or corner unless a more specific property overrides it.  This example
# gives focused edges different colours and uses one grey for the whole
# unfocused frame.  For a uniform focused frame, replace the eight
# border.active.* lines with, for example:
#
# decor -d default border.active 0x3434E0
# decor -d default border.active.n 0xE50000
# decor -d default border.active.s 0xC4D30D

decor -d default border.style fvwm
decor -d default border.active.image none
decor -d default border.inactive.image none
decor -d default border.active.gradient HGradient 0x458588 0x83a598
decor -d default border.inactive.gradient HGradient 0xa89984 0xebdbb2
decor -d default titlebar.active_gradient HGradient 0x458588 0x83a598
decor -d default titlebar.inactive_gradient HGradient 0xa89984 0xebdbb2
decor -d default container.tab.active_gradient HGradient 0x458588 0x83a598
decor -d default container.tab.inactive_gradient HGradient 0xa89984 0xebdbb2

# Titlebar buttons: odd numbers are placed on the left and even numbers on the
# right.  Button actions are configured with bind-decoration below.
decor -d default titlebar.button.1.vector 5 25x40@1 25x60@1 75x60@0 75x40@0 25x40@1
decor -d default titlebar.button.2.vector 4 50x75@1 25x25@1 75x25@1 50x75@0
decor -d default titlebar.button.0.vector 4 50x25@1 75x75@0 25x75@0 50x25@1

# Iconified windows use the application's desktop-entry icon.  Set icon.image
# to a PNG/SVG/XPM path to force one image, or to "none" for no image.
decor -d default icon.enabled true
decor -d default icon.size 32
decor -d default icon.image auto
# decor -d default icon.background 0x828282
# decor -d default icon.foreground 0xFFFFFF
# decor -d default icon.title_relief false

# Container tabs inherit suitable colours from the titlebar by default.  The
# following overrides demonstrate independent inactive-tab styling.  Remove
# them to retain the inherited colours, or enable the optional active values.
# decor -d default container.tab.active_colour 0x3434E0
# decor -d default container.tab.fg_active 0xFFFFFF
# decor -d default container.tab.inactive_colour 0x3434E0
# decor -d default container.tab.fg_inactive 0x000000
# decor -d default container.tab.sunken true

# Optional squeezed titlebar.  "natural" follows the title and button width;
# "fixed" uses titlebar.squeeze.width.  Justification may be left, centre, or
# right.  The unused part of the titlebar strip remains transparent.
# decor -d default titlebar.squeeze natural
# decor -d default titlebar.squeeze.justify left
# decor -d default titlebar.squeeze.width 300

# Optional gradients.  Use "none" to restore a solid colour.  Images are
# painted over gradients, so clear the corresponding image while experimenting.
# decor -d default border.active.image none
# decor -d default border.inactive.image none
# decor -d default border.active.gradient HGradient 0x0044CC 0xFF3030
# decor -d default border.inactive.gradient HGradient 0x203050 0x804040
# decor -d default titlebar.active_gradient HGradient 0x0044CC 0xFF3030
# decor -d default titlebar.inactive_gradient HGradient 0x203050 0x804040
# decor -d default container.tab.active_gradient HGradient 0x607080 0xC0CCD0

# Apply the completed profile globally and make it the default for new windows.
# When editing live, defining a property only changes the stored profile; send
# `moocow decor -a default` afterwards to make the changes visible.
decor -a default

# To use a theme pack instead, include it and apply the profile it defines.
# The last global `decor -a` command wins.  Relative image paths are resolved
# from the theme file.  See examples/themes/ for the supplied themes.
# include ~/.config/cow/themes/steel/theme.conf
# decor -a steel

# -----------------------------------------------------------------------------
# Icon placement
# -----------------------------------------------------------------------------
#
# Automatic placement starts at the bottom-left, fills right, and wraps up.
# This alternative fills down the right-hand side instead:
# icon-placement box full
# icon-placement fill down left
# icon-placement compact false

# Output-specific settings inherit unspecified global placement properties.
# `@2` selects output number 2; an output name may be used instead.
# icon-placement -o @2 box 96x900-0+0
# icon-placement -o @2 grid 8 8

# -----------------------------------------------------------------------------
# Decoration overlays and rules
# -----------------------------------------------------------------------------

# Profiles applied by rules are sparse overlays.  This example can remove the
# frame from cowiconman without replacing colours or images from the active
# global theme.  Uncomment all four lines to enable it.
# decor -d nodecor border.width 0
decor -d nodecor border.handles false
decor -d nodecor titlebar.enabled false
rule -g -T on-map -n nodecor -s %cowiconman decor -a nodecor

# Remove cowbuttons' own window decors using a cow rule:

# decor -d cowbuttons-nodecor border.width 0
decor -d cowbuttons-nodecor border.handles false
decor -d cowbuttons-nodecor titlebar.enabled false
rule -g -Ton-map -ncowbuttons-chrome -s %cowbuttons decor -a cowbuttons-nodecor

# decor -d cowpager-nodecor border.width 0
decor -d cowpager-nodecor border.handles false
decor -d cowpager-nodecor titlebar.enabled false
rule -g -Ton-map -ncowpager-chrome -s %cowpager decor -a cowpager-nodecor

# decor -d cowclock-nodecor border.width 0
decor -d cowclock-nodecor border.handles false
decor -d cowclock-nodecor titlebar.enabled false
rule -g -Ton-map -ncowclock-chrome -s %cowclock decor -a cowclock-nodecor

# This optional example tints desks 1 and 2.  `-t :1` means desk 1 on any
# output.  An on-desk rule is applied to every window on the desk whenever that
# desk becomes current or a view maps onto it.  Uncomment the definitions and
# rules together.
# decor -d per-1 titlebar.active_colour 0xFF8C00
# decor -d per-1 titlebar.active_gradient none
# decor -d per-1 titlebar.inactive_colour 0xB28E4C
# decor -d per-1 border.inactive 0xB28E4C
# decor -d per-2 titlebar.active_colour 0xFFD700
# decor -d per-2 titlebar.active_gradient none
# rule -T on-desk -t :1 -n per-1 decor -a per-1
# rule -T on-desk -t :2 -n per-2 decor -a per-2

# On restart, stop existing panel and status-program processes before startup
# commands create replacements.  Keep this list in sync with programs started
# here or by your compositor's startup file.
# rule -g -T on-restart -n cleanup \
#             exec killall waybar \; \
#             exec killall conky \; \
#             exec killall pasystray

rule -g -n mpv -T on-map -s %mpv script {
    winops -sS
    winops -L =top
    window-resize -w 640 -h 360
    window-move -x 1265 -y 705
    }

rule -g -T on-map -n cowbuttons script {
    if self.title == "cowbuttons:Status" and self.output == "HDMI-A-1"{
        winops -sS
        winops -C on
        window-move -x 1485 -y 5
    }
    if self.title == "cowbuttons:Status" and self.output == "eDP-1"{
        winops -sS
        winops -C on
        window-move -x 3405 -y 5
    }
    if self.title == "cowbuttons:Clock" and self.output == "HDMI-A-1"{
        winops -sS
        winops -C on
        window-move -x 825 -y 5
    }
    if self.title == "cowbuttons:Clock" and self.output == "eDP-1"{
        winops -sS
        winops -C on
        window-move -x 2745 -y 5
    }
}

rule -g -T on-map -n cowclock script {
    if self.title == "Clock" and self.output == "HDMI-A-1"{
        winops -sS
        winops -C on
        window-move -x 1767 -y 60
    }
    if self.title == "Clock" and self.output == "eDP-1"{
        winops -sS
        winops -C on
        window-move -x 3687 -y 60
    }
}

rule -g -T on-map -n cowiconman -s /cowiconman:/ script {
    if self.output == "HDMI-A-1"{
        winops -sS
        winops -C on
        window-move -x 1657 -y 220
    }
    if self.output == "eDP-1"{
        winops -sS
        winops -C on
        window-move -x 3577 -y 220
    }
}

rule -g -T on-map -n cowpager -s /cowpager:/ script {
    if self.output == "HDMI-A-1"{
        winops -sS
        winops -C on
        window-move -x 15 -y 5
    }
    if self.output == "eDP-1"{
        winops -sS
        winops -C on
        window-move -x 1935 -y 5
    }
}

# -----------------------------------------------------------------------------
# Keyboard bindings
# -----------------------------------------------------------------------------

# Generate direct desk bindings from output @1's canonical desk list.  Number
# keys cover desks 0 through 9; desks beyond that remain available through the
# next/previous bindings and menus.  The top-level script handles config
# reloads, when outputs already exist.
script {
    for d in (desks where d.output_number == 1 and d.nr <= 9) {
        bind "L+#{d.nr}" desk -d #{d.nr}
        bind "LS+#{d.nr}" window-move -k #{d.nr}
    }
}

# On initial startup, install the bindings after outputs and desks exist.
rule -g -T on-outputs-changed -n desk-number-bindings script {
    bind -d "L+[0-9]"
    bind -d "LS+[0-9]"
    for d in (desks where d.output_number == 1 and d.nr <= 9) {
        bind "L+#{d.nr}" desk -d #{d.nr}
        bind "LS+#{d.nr}" window-move -k #{d.nr}
    }
}

# Rebuild after `moocow set desks.count N` changes the live desk sets.
rule -g -T on-desks-changed -n desk-number-bindings-on-resize script {
    bind -d "L+[0-9]"
    bind -d "LS+[0-9]"
    for d in (desks where d.output_number == 1 and d.nr <= 9) {
        bind "L+#{d.nr}" desk -d #{d.nr}
        bind "LS+#{d.nr}" window-move -k #{d.nr}
    }
}

# Cycle through every configured desk, including desks without a number key.
bind L+bracketright desk -n
bind L+bracketleft desk -p

# Desk collection.  This will show windows on the specified desk (the current
# output is implied).  When this happens, these "collected" windows can be
# moved, resized, etc.  When the desk is uncollected (this command acts as a
# toggle), the windows go back to their original desk, and their geometries
# are restored.
#
# This gives a handy way of glancing at other windows without having to make
# them sticky, for example.
bind LA+0 desk -c 0
bind LA+1 desk -c 1
bind LA+2 desk -c 2
bind LA+3 desk -c 3
bind LA+4 desk -c 4
bind LA+5 desk -c 5
bind LA+6 desk -c 6
bind LA+7 desk -c 7
bind LA+8 desk -c 8
bind LA+9 desk -c 9

# Window operations.  -c close, -r raise, -l lower, etc.
bind LS+a winops -c

# -s sticks to desks, -S sticks to pages.  Combine the two for window
# stickiness over everything.
bind L+s winops -sS
bind A+up winops -r
bind A+down winops -l
bind L+m window-maximize -T
bind C+Return window-expand -T
bind C+i winops -i

# Full screen a window regardless of reserved areas
bind L+f window-maximize -T -R

# CirculateSkip removes matching windows from next/previous focus circulation
# while leaving explicit focus and mouse focus available.
# rule -g -T on-map -n skip-cowpager -s %cowpager winops -C on
# rule -g -T on-map -n skip-cowbar -s %cowbar winops -C on

# Focus windows, next/prev.  -F adds a DSL predicate to circulation.
# Examples:
#   focus -nw -F 'self.current_desk'
#   focus -nw -F 'self.current_output'
#   focus -nw -F 'self.current_output and self.current_page'
bind A+Tab focus -nw -F 'self.current_output and self.current_page'
bind AS+Tab focus -pw -F 'self.current_output and self.current_page'

# Move (see the `step` setting).
bind -r LS+Up window-move -w -d up
bind -r LS+Down window-move -w -d down
bind -r LS+Left window-move -w -d left
bind -r LS+Right window-move -w -d right

# Move (snap to the nearest edge or cross a monitor boundary).
bind L+Up window-move -nw -d up
bind L+Down window-move -nw -d down
bind L+Left window-move -nw -d left
bind L+Right window-move -nw -d right

# Centre the window and focus.
 bind L+c script {
     window-move -c
     focus -w
 }

# Resize.  Without Shift, move the north/west edge; with Shift, move the
# south/east edge.
bind LA+Up window-resize -g -d up
bind LA+Down window-resize -s -d up
bind LAS+Up window-resize -s -d down
bind LAS+Down window-resize -g -d down
bind LA+Left window-resize -g -d left
bind LA+Right window-resize -s -d left
bind LAS+Left window-resize -s -d right
bind LAS+Right window-resize -g -d right

# End the session.
bind LCA+q quit

# Run external commands.  Replace these examples with the terminal, launcher,
# and power-management commands available on your system.
bind L+Return exec foot
bind L+d exec fuzzel 

# Restart CoW
bind LS+r exec "pkill -USR1 cow"

# Power menu
bind LS+p exec sh "$HOME/.local/bin/power-menu-fuzzel.sh"

# Emoji menu
bind LS+z exec sh "$HOME/.local/bin/emoji-menu.sh"

# Take a screenshot of the focused output
bind 0+Print exec sh "$HOME/.local/bin/screenshot.sh"

# Take a screenshot of the focused window
bind S+Print exec sh "$HOME/.local/bin/screenshot.sh focused-window"

# Take a screenshot of the selected region
bind L+Print exec sh "$HOME/.local/bin/screenshot.sh selected-region"

# Take a screenshot and save it to the clipboard
bind LS+Print exec sh "$HOME/.local/bin/screenshot.sh save-to-clipboard"

# Take a recording of the focused output
bind C+Print exec sh "$HOME/.local/bin/screenrecord.sh"

# Take a recording of the focused window
bind CS+Print exec sh "$HOME/.local/bin/screenrecord.sh focused-window"

# Take a recording of the selected region
bind CL+Print exec sh "$HOME/.local/bin/screenrecord.sh selected-region"

# Stop all screen recording
bind CS+BackSpace exec "pkill -SIGINT wf-recorder"

# Raise cowpager, cowbuttons, cowclock and cowiconman
bind LS+b script {
    for w in (windows where w.app_id == "cowpager") {
        winops -r
    }
    for w in (windows where w.app_id == "cowbuttons") {
        winops -r
    }
    for w in (windows where w.app_id == "cowclock") {
        winops -r
    }
    for w in (windows where w.app_id == "cowiconman") {
        winops -r
    }
}

# -----------------------------------------------------------------------------
# Mouse and decoration bindings
# -----------------------------------------------------------------------------

# Hold the chosen modifier while dragging anywhere in a window.
mouse L+left   window-move
mouse L+right  window-resize
# Super+middle-drag: drag a window's titlebar onto another to containerise
# them.  Release over the target's titlebar to group; release over empty
# space completes a normal move.  Super+Shift+left is an alternative for
# environments where middle-click is unavailable (e.g. VNC).
mouse LA+left window-move -C
mouse LS+left  window-container -r

# Decoration click bindings.
#
# The primary mouse button (button 1) can be bound to actions on a window's
# decoration.  See the *ANATOMY OF A WINDOW* section in cow(1).
#
# The -2 argument makes a binding fire on a double-click.
#
# A region can carry both a single-click and a double-click binding at
# the same time.

# Single-click edges / corners: interactive resize on the matching side.
bind-decoration N  window-resize -e n
bind-decoration S  window-resize -e s
bind-decoration E  window-resize -e e
bind-decoration W  window-resize -e w
bind-decoration NE window-resize -e ne
bind-decoration NW window-resize -e nw
bind-decoration SE window-resize -e se
bind-decoration SW window-resize -e sw

# Single-click titlebar:   interactive move.
# Double-click titlebar:   shade / unshade.
bind-decoration titlebar     window-move
bind-decoration -2 titlebar  window-shade -d titlebar

# Titlebar buttons 0, 1, and 2 maximise, close, and iconify respectively.
bind-decoration 0 window-maximize -T
bind-decoration 1 winops -c
bind-decoration 2 winops -i

# Example overrides (commented out):
#bind-decoration titlebar     window-maximize -m       # left-click maximises
#bind-decoration -2 NE        winops -c                # NE double-click closes
#bind-decoration -2 0         window-maximize -m        # button 0 double-click

# -----------------------------------------------------------------------------
# Window containers
# -----------------------------------------------------------------------------

# Keyboard bindings for tabbed window containers.
# Super+G: group focused window with the next window in stacking order.
# Works without a mouse -- useful in VNC or keyboard-only environments.
bind L+g window-container -a
# Super+Shift+G: remove the focused window from its container.
bind LS+g window-container -r
# Super+Tab / Super+Shift+Tab: cycle tabs within the focused container.
bind L+Tab   window-container -n
bind LS+Tab  window-container -p
# Super+Ctrl+Tab / Super+Ctrl+Shift+Tab: reorder tabs within the container.
bind LC+Tab  window-container -N
bind LCS+Tab window-container -P

# -----------------------------------------------------------------------------
# Page navigation
# -----------------------------------------------------------------------------

# These bindings are only useful when desktop_size is greater than 1x1.  The
# `scroll` command pans the desk viewport by whole pages (with -d / -n / -P)
# or by arbitrary sub-page offsets (a bare "H V" percentage, "-p H V" pixels,
# or an interactive "-r" drag bound to a mouse button).  See `show -a command`
# for the full command surface.
#
# Super+Ctrl+Right/Left/Down/Up: jump one page in that direction
# bind LC+Right  scroll -d right
# bind LC+Left   scroll -d left
# bind LC+Down   scroll -d down
# bind LC+Up     scroll -d up

# Super+Ctrl+n / Super+Ctrl+p: next / previous page (with wrap)
# bind LC+n  scroll -n
# bind LC+p  scroll -P

# Ctrl+Meta+Button1: grab and drag the desk viewport
# mouse CM+Left scroll -r

# -----------------------------------------------------------------------------
# Startup programs
# -----------------------------------------------------------------------------

# These commands run each time cow starts.  Keep only programs installed on
# your system.  Programs which do not replace an existing instance should also
# be added to the on-restart cleanup rule above.

exec sh "$HOME/.config/cow/scripts/after-start.sh"

# -----------------------------------------------------------------------------
# Menus
# -----------------------------------------------------------------------------
#
# Define menus with menu-add, then bind them to mouse buttons or keys.
# Selectable items can use `menu-add -i terminal.svg ...`.  Relative icon
# names are searched in ~/.config/cow/icons by default; set a colon-separated
# search path to use another directory:
menu-style icon.path ~/.config/cow/icons:/usr/local/share/cow/icons:/usr/local/share/icons/hicolor/scalable/apps

# Blue 3D menu appearance.
# Solid colours are the fallback/base colours.  Gradient values use:
#   none | HGradient <colour> <colour> | VGradient <colour> <colour>
menu-style bg                 0x458588
menu-style fg                 0xffffff
menu-style title.bg           0x0f3977
menu-style title.fg           0xffffff
menu-style separator          0x458588
menu-style bg.gradient        HGradient 0x458588 0x83a598
menu-style title.bg.gradient  HGradient 0x458588 0x83a598 
menu-style border.colour      0x83a598
menu-style border.width       4
menu-style padding.x          8
menu-style padding.y          3
menu-style icon.size          16
menu-style icon.gap           4
menu-style title.underlines   2
menu-style automatic.hotkeys  true

# Named menus may override any of the global style properties.  Properties
# not listed here continue to use the global values above, including geometry
# and the default raised selection relief.
# menu-style -m SendToDesk bg        0xddd3ea
# menu-style -m SendToDesk fg        0x2f183f
# menu-style -m SendToDesk title.bg  0x704787
# menu-style -m SendToDesk title.fg  0xffffff
# menu-style -m SendToDesk separator 0xa38ab3
# menu-style -m SendToDesk border.colour 0x4b2c5c
#
# menu-style -m WindowOps bg        0xe7d8d2
# menu-style -m WindowOps fg        0x321915
# menu-style -m WindowOps title.bg  0x8b3a2f
# menu-style -m WindowOps title.fg  0xffffff
# menu-style -m WindowOps separator 0xb78378
# menu-style -m WindowOps border.colour 0x57231d
#
# menu-style -m RootMenu bg        0xd7e4e2
# menu-style -m RootMenu fg        0x102b29
# menu-style -m RootMenu title.bg  0x0d7068
# menu-style -m RootMenu title.fg  0xffffff
# menu-style -m RootMenu separator 0x72aaa5
# menu-style -m RootMenu border.colour 0x084b46

# Sub-menu: send a window to a desk.  Every output has the configured number
# of desks, so use output @1 as the canonical list to avoid duplicate entries
# with desktop-configuration per-output.  The top-level script handles config
# reloads, when outputs already exist.
menu-add SendToDesk "Send to Desk" title
script {
    for d in (desks where d.output_number == 1) {
        menu-add SendToDesk "Desk #{d.nr}" "window-move -k #{d.nr}"
    }
}

# On initial startup the config is read before outputs exist.  Build the menu
# once their desk sets are available, and rebuild it after output changes.
rule -g -T on-outputs-changed -n send-to-desk-menu script {
    menu-clear SendToDesk
    menu-add SendToDesk "Send to Desk" title
    for d in (desks where d.output_number == 1) {
        menu-add SendToDesk "Desk #{d.nr}" "window-move -k #{d.nr}"
    }
}

# Keep the menu in sync with runtime changes to desks.count as well.
rule -g -T on-desks-changed -n send-to-desk-menu-on-resize script {
    menu-clear SendToDesk
    menu-add SendToDesk "Send to Desk" title
    for d in (desks where d.output_number == 1) {
        menu-add SendToDesk "Desk #{d.nr}" "window-move -k #{d.nr}"
    }
}

# Window operations menu.
menu-add WindowOps  "Window"        title
menu-add WindowOps  "Move"          "window-move"
menu-add WindowOps  "Resize"        "window-resize"
menu-add WindowOps  "Maximise"      "window-maximize"
menu-add WindowOps  "Shade"         "window-shade -d titlebar"
menu-add WindowOps  -               -
menu-add WindowOps  "Send To Desk"  "popup SendToDesk"
menu-add WindowOps  -               -
menu-add WindowOps  "Iconify"       "winops -i"
menu-add WindowOps  "Close"         "winops -c"

# Root menu.
menu-add RootMenu   "CoW"           title
# With ~/.config/cow/icons/terminal.svg installed, the following may instead
# be written as: menu-add -i terminal.svg RootMenu "XTerm" "exec xterm"
# menu-add RootMenu   "XTerm"         "exec xterm"
menu-add -i foot.svg RootMenu "Terminal" "exec foot"
menu-add RootMenu   -               -
menu-add RootMenu   "Window Ops"    "popup-pick WindowOps"
menu-add RootMenu   -               -
menu-add RootMenu   "Restart"       "exec moocow exec cow"
menu-add RootMenu   "Quit"          "quit"

# Mouse bindings for menus.
# Left-click on the root window → root menu.
mouse R:0+left      "menu-show RootMenu"

# Right-click an iconified-window icon to open the window operations menu.
# The I: context makes the icon's window the target of the menu actions.
mouse I:0+right     "menu-show WindowOps"
#
# If a window menu is not invoked from a known window context, use
# pick-window so the selected menu action targets the picked window.
# bind M+w "pick-window menu-show WindowOps"