summary refs log tree commit diff
path: root/.config/river/keybinds
blob: 516b6539542850a4bcc4a9cb0926df8b6b59854a (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
#!/bin/sh

. "$XDG_CONFIG_HOME/river/functions.sh"

export mod=Super

# Note: the "$mod" modifier is also known as Logo, GUI, Windows, $mod, etc.
riverctl map normal $mod+Shift Q close
riverctl map normal $mod+Shift E exit

# $mod+J and $mod+K to focus the next/previous view in the layout stack
riverctl map normal $mod J focus-view next
riverctl map normal $mod K focus-view previous
riverctl map normal $mod L focus-view right
riverctl map normal $mod H focus-view left

# $mod+Shift+J and $mod+Shift+K to swap the focused view with the next/previous
# view in the layout stack
riverctl map normal $mod+Shift J swap next
riverctl map normal $mod+Shift K swap previous
riverctl map normal $mod+Shift L swap right
riverctl map normal $mod+Shift H swap left

riverctl map normal $mod Backspace focus-previous-tags
riverctl map normal $mod+Shift Backspace move-previous-tags

# $mod+Period and $mod+Comma to focus the next/previous output
riverctl map normal $mod Period focus-output next
riverctl map normal $mod Comma focus-output previous

# $mod+Shift+{Period,Comma} to send the focused view to the next/previous output
riverctl map normal $mod+Shift Period spawn 'riverctl send-to-output next && riverctl focus-output next'
riverctl map normal $mod+Shift Comma spawn 'riverctl send-to-output previous && riverctl focus-output previous'

# bump the focused view to the top of the layout stack
riverctl map normal $mod+Shift Return zoom

# $mod++ and $mod+- to decrease/increase the main ratio of rivertile(1)
riverctl map normal $mod Equal send-layout-cmd rivertile "main-ratio +0.05"
riverctl map normal $mod Minus send-layout-cmd rivertile "main-ratio -0.05"

# $mod+Shift+H and $mod+Shift+L to increment/decrement the main count of rivertile(1)
riverctl map normal $mod Plus send-layout-cmd rivertile "main-count +1"
riverctl map normal $mod Underscore send-layout-cmd rivertile "main-count -1"

# snap views to screen edges
# riverctl map normal $mod+Control H snap left
# riverctl map normal $mod+Control J snap down
# riverctl map normal $mod+Control K snap up
# riverctl map normal $mod+Control L snap right

declare_mode resize $mod R
map_mode -n resize None h resize horizontal 100
map_mode -n resize None j resize vertical -100
map_mode -n resize None k resize vertical 100
map_mode -n resize None l resize horizontal -100

riverctl map-pointer normal $mod BTN_LEFT move-view
riverctl map-pointer normal $mod BTN_RIGHT resize-view

riverctl focus-follows-cursor normal

# tag management
for i in $(seq 1 9); do
	tags=$((1 << (i - 1)))

	riverctl map normal $mod "$i" set-focused-tags "$tags"
	riverctl map normal $mod+Shift "$i" set-view-tags "$tags"
	riverctl map normal $mod+Control "$i" toggle-focused-tags "$tags"
	riverctl map normal $mod+Shift+Control "$i" toggle-view-tags "$tags"
done

# $mod+0 to focus all tags
# $mod+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map normal $mod 0 set-focused-tags $all_tags
riverctl map normal $mod+Shift 0 set-view-tags $all_tags
riverctl map normal $mod+Control 0 toggle-focused-tags "$all_tags"
riverctl map normal $mod+Control+Shift 0 toggle-view-tags $all_tags

scratch_tag=$((1 << 31))
riverctl spawn-tagmask $((all_tags ^ scratch_tag))
riverctl map normal $mod Delete toggle-focused-tags "$scratch_tag"

# $mod+Space to toggle float
riverctl map normal $mod+Shift Space toggle-float

# $mod+F to toggle fullscreen
riverctl map normal $mod F toggle-fullscreen
# $mod+{Up,Right,Down,Left} to change layout orientation
riverctl map normal $mod Up send-layout-cmd rivertile "main-location top"
riverctl map normal $mod Right send-layout-cmd rivertile "main-location right"
riverctl map normal $mod Down send-layout-cmd rivertile "main-location bottom"
riverctl map normal $mod Left send-layout-cmd rivertile "main-location left"

# Declare a passthrough mode. This mode has only a single mapping to return to
# normal mode. This makes it useful for testing a nested wayland compositor
riverctl declare-mode passthrough
# enter passthrough mode
riverctl map normal $mod F11 enter-mode passthrough
# return to normal mode
riverctl map passthrough $mod F11 enter-mode normal

# run application launcher
# riverctl map normal $mod Return spawn foot
# riverctl map normal $mod Return spawn footclient
riverctl map normal $mod Return spawn ghostty
riverctl map normal $mod D spawn 'menu -run'
riverctl map normal $mod W spawn 'oguri-cycle'

declare_mode menu $mod M
map_mode menu None A 'riverctl spawn soundswitch'
map_mode menu None B 'riverctl spawn bluemenu'
map_mode menu None C 'riverctl spawn connmenu'
map_mode menu None D 'riverctl spawn domenu'
map_mode menu None M 'riverctl spawn mnts'
map_mode menu None N 'riverctl spawn notifmenu'
map_mode menu None O 'riverctl spawn modemenu'
map_mode menu None P 'riverctl spawn passmenu2'
map_mode menu None R 'riverctl spawn rcmenu'
map_mode menu None V 'riverctl spawn vpnmenu'
map_mode menu None Delete 'riverctl spawn powermenu'

# TODO: screenshot mode
declare_mode screenshot $mod+Shift S
map_mode screenshot None s 'grimshot copy area'
map_mode screenshot Shift s 'grimshot save area'
map_mode screenshot None o 'grimshot copy output'
map_mode screenshot Shift o 'grimshot save output'
map_mode screenshot Shift a 'grimshot copy win'
map_mode screenshot None a 'grimshot copy'
map_mode screenshot Shift a 'grimshot copy'

riverctl map normal $mod X spawn 'wtype -P XF86Cut'
riverctl map normal $mod C spawn 'wtype -P XF86Copy'
riverctl map normal $mod V spawn 'wtype -P XF86Paste'
#riverctl map normal $mod+Shift V spawn 'wl-paste -p -n | wtype -d 10 -s 5 -'
riverctl map normal $mod B spawn 'pkill -USR1 waybar'

riverctl map normal $mod G spawn 'wl-kbptr'
declare_mode mouse $mod+Shift G
map_mode mouse None t 'wl-kbptr -o modes=tile,bisect'
map_mode mouse None b 'wl-kbptr -o modes=bisect'
map_mode mouse None c 'wl-kbptr -o modes=click'
# TODO: wlrctl pointer ...

# Various media key mapping examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked; do
	riverctl map $mode None XF86AudioRaiseVolume spawn 'soundswitch -V'
	riverctl map $mode None XF86AudioLowerVolume spawn 'soundswitch -v'
	riverctl map $mode None XF86AudioMute spawn 'soundswitch -m'

	# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
	riverctl map $mode None XF86AudioPlay spawn 'playerctl -p playerctld play-pause'
	riverctl map $mode None XF86AudioPrev spawn 'playerctl -p playerctld previous'
	riverctl map $mode None XF86AudioNext spawn 'playerctl -p playerctld next'

	riverctl map $mode None XF86MonBrightnessUp spawn 'light set +5%'
	riverctl map $mode None XF86MonBrightnessDown spawn 'light set 5%-'

	# AudioMedia is F12/framework logo key
	riverctl map $mode None XF86AudioMedia spawn 'kanshictl reload'
	riverctl map $mode None XF86Keyboard spawn 'light set 0%'
	riverctl map $mode None XF86Favorites spawn 'light set 100%'
done

# suspend on lid closing
riverctl map-switch normal lid close spawn 'suspend-then-hibernate'

declare_mode ocr $mod o
map_mode ocr None o 'transformers_ocr recognize'
map_mode ocr None h 'transformers_ocr hold'
map_mode ocr None x 'transformers_ocr stop'