~tardypad/dotfiles

ref: e0559832d0222c315135f2044b903bc8147a7057 dotfiles/files/configs/sway/config.d/bindings -rw-r--r-- 9.7 KiB
e0559832 — Damien Tardy-Panis Decrease font size again 1 year, 1 month ago
                                                                                
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
## general

# exit sway
bindsym $mod+Ctrl+{key/quit/low} exit

# reload the configuration file
bindsym $mod+Alt+Shift+{key/reload_config/low} reload

# general command input
bindsym $mod+{key/command/colon} exec sway-command-input

# lock the screen
bindsym $mod+{key/backspace/Backspace} exec swaylock

# suspend
bindsym --locked $mod+Ctrl+{key/backspace/Backspace} exec systemctl suspend

# focus first window with urgent flag
bindsym $mod+{key/u} [urgent="first"] focus

# do not disturb toggle
bindsym $mod+{key/escape/Escape} exec do-not-disturb toggle

# toggle Pomodoro session
bindsym $mod+Shift+{key/escape/Escape} exec pomodoro toggle

# stop task
bindsym $mod+Ctrl+{key/escape/Escape} exec task stop

# select region and grab screenshot
bindsym $mod+{key/g} exec screenshot

# toggle bar status mode
bindsym $mod+{key/tabulation/Tab} exec i3blocks-mode toggle

# run quick command
bindsym $mod+{key/return/Return} exec sway-quick-command

# toggle idle inhibitor on current window
bindsym $mod+{key/i} exec sway-toggle-window-idle-inhibitor visible \
                          && pkill -x -RTMIN+8 i3blocks

# toggle night mode
bindsym --locked $mod+{key/t} exec night-mode toggle

# toggle presentation mode
bindsym $mod+Ctrl+{key/p} exec presentation-mode toggle

# Press enter in the presentation window
bindsym $mod+{key/bracketright} exec "swaymsg -q -- mark --add presentation_main \
                                && swaymsg -q '[title=\"sway_presentation\"]' focus \
                                && ydotool sleep 100 , key enter 2> /dev/null \
                                && swaymsg -q '[con_mark=\"presentation_main\"]' focus"


## notifications

bindsym --locked $mod+Ctrl+{key/close/low}       exec makoctl dismiss
bindsym --locked $mod+Ctrl+Shift+{key/close/low} exec makoctl dismiss --all


## Commands

mode "-- Commands --" {
    bindsym {key/space/Space}         mode "default", exec bemenu-run -p 'Run'
    bindsym {key/backspace/Backspace} mode "default", exec system-menu

    bindsym {key/c} mode "default", exec {app/chat_client}
    bindsym {key/d} mode "default", exec open-document
    bindsym {key/e} mode "default", exec {app/terminal_emulator}
    bindsym {key/h} mode "default", exec {app/system_monitor}
    bindsym {key/j} mode "default", exec launch-tmux-env projects
    bindsym {key/m} mode "default", exec {app/mail_client}
    bindsym {key/o} mode "default", exec copy-otp
    bindsym {key/p} mode "default", exec copy-password
    bindsym {key/s} mode "default", exec play-somafm
    bindsym {key/t} mode "default", exec sway-quick-command start-task
    bindsym {key/w} mode "default", exec {app/web_browser}

    bindsym Ctrl+{key/p} mode "default", exec {app/presentation}

    bindsym {key/return/Return} mode "default"
    bindsym {key/escape/Escape} mode "default"
}
bindsym $mod+{key/space/Space} mode "-- Commands --"


## floating

floating_modifier $mod normal
bindsym $mod+Shift+{key/f} floating toggle
bindsym $mod+{key/f}       focus mode_toggle


## scratchpad

bindsym $mod+Shift+{key/d} move scratchpad
bindsym $mod+{key/d}       scratchpad show


## workspaces management (lowercase)

bindsym $mod+{key/create/low} exec sway-create-workspace
bindsym $mod+{key/rename/low} exec sway-rename-workspace

# select
bindsym $mod+{key/alternate/low} workspace back_and_forth
bindsym $mod+{key/next/low}      workspace next_on_output
bindsym $mod+{key/right/low}     workspace next_on_output
bindsym $mod+{key/previous/low}  workspace prev_on_output
bindsym $mod+{key/left/low}      workspace prev_on_output
bindsym $mod+{key/1}             workspace number 1
bindsym $mod+{key/2}             workspace number 2
bindsym $mod+{key/3}             workspace number 3
bindsym $mod+{key/4}             workspace number 4
bindsym $mod+{key/5}             workspace number 5
bindsym $mod+{key/6}             workspace number 6
bindsym $mod+{key/7}             workspace number 7
bindsym $mod+{key/8}             workspace number 8
bindsym $mod+{key/9}             workspace number 9
bindsym $mod+{key/0}             workspace number 10

# split
bindsym $mod+{key/split_vertical/low}   splith, exec {app/terminal_emulator}
bindsym $mod+{key/split_horizontal/low} splitv, exec {app/terminal_emulator}

# move mode
mode "-- move --" {
    bindsym {key/next/low}     exec sway-move-workspace-direction next
    bindsym {key/right/low}    exec sway-move-workspace-direction next
    bindsym {key/previous/low} exec sway-move-workspace-direction prev
    bindsym {key/left/low}     exec sway-move-workspace-direction prev
    bindsym {key/1}            exec sway-move-workspace-index 1
    bindsym {key/2}            exec sway-move-workspace-index 2
    bindsym {key/3}            exec sway-move-workspace-index 3
    bindsym {key/4}            exec sway-move-workspace-index 4
    bindsym {key/5}            exec sway-move-workspace-index 5
    bindsym {key/6}            exec sway-move-workspace-index 6
    bindsym {key/7}            exec sway-move-workspace-index 7
    bindsym {key/8}            exec sway-move-workspace-index 8
    bindsym {key/9}            exec sway-move-workspace-index 9
    bindsym {key/0}            exec sway-move-workspace-index 0

    bindsym {key/return/Return} mode "default"
    bindsym {key/escape/Escape} mode "default"
}
bindsym $mod+{key/move/low} mode "-- move --"

# layout mode
mode "-- layout --" {
    bindsym {key/1} layout splith
    bindsym {key/2} layout splitv
    bindsym {key/3} layout tabbed

    bindsym {key/return/Return} mode "default"
    bindsym {key/escape/Escape} mode "default"
}
bindsym $mod+{key/layout/low} mode "-- layout --"


## windows management (uppercase)

bindsym $mod+Shift+{key/create/low} exec {app/terminal_emulator}
bindsym $mod+Shift+{key/close/low}  kill
bindsym $mod+Shift+{key/zoom/low}   fullscreen

# select
bindsym $mod+Shift+{key/next/low}     focus next
bindsym $mod+Shift+{key/previous/low} focus prev
bindsym $mod+Shift+{key/left/low}     focus left
bindsym $mod+Shift+{key/down/low}     focus down
bindsym $mod+Shift+{key/up/low}       focus up
bindsym $mod+Shift+{key/right/low}    focus right

# move mode
mode "-- MOVE --" {
    # move focused window within workspace
    bindsym Shift+{key/left/low}  move left
    bindsym Shift+{key/down/low}  move down
    bindsym Shift+{key/up/low}    move up
    bindsym Shift+{key/right/low} move right

    # move focused container to workspace and follow
    bindsym {key/1}             move container to workspace number 1, workspace number 1
    bindsym {key/2}             move container to workspace number 2, workspace number 2
    bindsym {key/3}             move container to workspace number 3, workspace number 3
    bindsym {key/4}             move container to workspace number 4, workspace number 4
    bindsym {key/5}             move container to workspace number 5, workspace number 5
    bindsym {key/6}             move container to workspace number 6, workspace number 6
    bindsym {key/7}             move container to workspace number 7, workspace number 7
    bindsym {key/8}             move container to workspace number 8, workspace number 8
    bindsym {key/9}             move container to workspace number 9, workspace number 9
    bindsym {key/0}             move container to workspace number 10, workspace number 10
    bindsym {key/create/low}    exec sway-move-window-new-workspace
    bindsym {key/alternate/low} move container to workspace back_and_forth, workspace back_and_forth
    bindsym {key/next/low}      move container to workspace next_on_output, workspace next_on_output
    bindsym {key/right/low}     move container to workspace next_on_output, workspace next_on_output
    bindsym {key/previous/low}  move container to workspace prev_on_output, workspace prev_on_output
    bindsym {key/left/low}      move container to workspace prev_on_output, workspace prev_on_output

    bindsym {key/return/Return} mode "default"
    bindsym {key/escape/Escape} mode "default"
}
bindsym $mod+Shift+{key/move/low} mode "-- MOVE --"

# resize mode
mode "-- RESIZE --" {
    bindsym Shift+{key/left/low}  resize shrink width 10 px or 10 ppt
    bindsym Shift+{key/up/low}    resize grow height 10 px or 10 ppt
    bindsym Shift+{key/down/low}  resize shrink height 10 px or 10 ppt
    bindsym Shift+{key/right/low} resize grow width 10 px or 10 ppt

    bindsym {key/return/Return} mode "default"
    bindsym {key/escape/Escape} mode "default"
}
bindsym $mod+Shift+{key/resize/low} mode "-- RESIZE --"


## XF86 keys

# Volume keys
bindsym --locked {key/XF86AudioRaiseVolume} exec amixer -q set Master unmute 5%+ \
                                                 && pkill -x -RTMIN+2 i3blocks
bindsym --locked {key/XF86AudioLowerVolume} exec amixer -q set Master unmute 5%- \
                                                 && pkill -x -RTMIN+2 i3blocks
bindsym --locked {key/XF86AudioMute}        exec amixer -q set Master toggle \
                                                 && pkill -x -RTMIN+2 i3blocks

# Microphone key
bindsym --locked {key/XF86AudioMicMute} exec amixer -q set Capture toggle \
                                             && pkill -x -RTMIN+7 i3blocks
bindsym --locked $mod+{key/F4}          exec amixer -q set Capture toggle \
                                             && pkill -x -RTMIN+7 i3blocks

# Backlight keys
bindsym --locked {key/XF86MonBrightnessUp}   exec light -A 5
bindsym --locked {key/XF86MonBrightnessDown} exec light -U 5

# Media keys
bindsym --locked {key/XF86AudioPlay} exec mpc toggle \
                                          && pkill -x -RTMIN+4 i3blocks
bindsym --locked {key/XF86AudioNext} exec mpc next \
                                          && pkill -x -RTMIN+4 i3blocks
bindsym --locked {key/XF86AudioPrev} exec mpc prev \
                                          && pkill -x -RTMIN+4 i3blocks