sway: overhaul some bindings
[~bandali/configs] / .config / sway / config
... / ...
CommitLineData
1### Variables
2# super
3set $mod Mod4
4# alt
5set $mod2 Mod1
6set $left h
7set $down j
8set $up k
9set $right l
10set $term urxvt
11set $menu rofi -show run -display-run '> ' -display-window ' 🗔 '
12set $pass rofi-pass
13
14### Output configuration
15#
16# Default wallpaper (more resolutions are available in __DATADIR__/backgrounds/sway/)
17output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
18#
19# Example configuration:
20#
21# output HDMI-A-1 resolution 1920x1080 position 1920,0
22#
23# You can get the names of your outputs by running: swaymsg -t get_outputs
24
25# output DP-1 res 2560x1440 pos 1366,0
26# # 672 = 1440 - 768
27# output LVDS-1 pos 0,760
28
29output DP-1 res 2560x1440 pos 0,0
30# 672 = 1440 - 768
31output LVDS-1 pos 2560,760
32
33### Idle configuration
34
35exec swayidle \
36 timeout 120 '[ -f ~/.nosleep ] || swaymsg "output * dpms off"' \
37 resume '[ -f ~/.nosleep ] || swaymsg "output * dpms on"' \
38
39
40### Key bindings
41#
42# Basics:
43#
44
45set $floating_term $term -name floating
46for_window [class="URxvt" instance="floating"] floating enable
47
48set $mode_launch (⏎)urxvt | | (e)macs | (i)cecat/weasel
49mode "$mode_launch" {
50 bindsym Return exec $floating_term, mode "default"
51 bindsym p exec $pass, mode "default"
52 bindsym e exec emacs, mode "default"
53
54 # back to normal: Escape, or q
55 bindsym Escape mode "default"
56 bindsym q mode "default"
57}
58 bindsym $mod+tab mode "$mode_launch"
59 bindsym XF86Launch1 mode "$mode_launch"
60
61 # start a terminal
62 bindsym $mod+Return exec $term
63 bindsym $mod+Shift+Return exec $floating_term
64
65 # kill focused window
66 bindsym $mod+Shift+q kill
67
68 # start your launcher
69 bindsym $mod+space exec $menu
70
71 # start your launcher
72 bindsym $mod+Shift+space exec $pass
73
74 # Drag floating windows by holding down $mod and left mouse button.
75 # Resize them with right mouse button + $mod.
76 # Despite the name, also works for non-floating windows.
77 # Change normal to inverse to use left mouse button for resizing and right
78 # mouse button for dragging.
79 floating_modifier $mod normal
80
81 # reload the configuration file
82 bindsym $mod+Shift+c reload
83
84 # exit sway (logs you out of your wayland session)
85 # bindsym $mod+Shift+e exit
86
87 bindsym $mod+apostrophe exec rofi-light # rofi-based brightness chooser
88 bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness
89 bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness
90
91 bindsym XF86AudioRaiseVolume exec pamixer --allow-boost --increase 5
92 bindsym XF86AudioLowerVolume exec pamixer --allow-boost --decrease 5
93 bindsym XF86AudioMute exec pamixer --toggle-mute
94 bindsym XF86AudioMicMute exec pactl set-source-mute 1 toggle
95
96 bindsym $mod+Shift+apostrophe exec rofi-remmina.py # choose remmina connection
97
98 # original sway workspace switch and window move
99 bindsym $mod+bracketleft workspace prev
100 bindsym $mod+bracketright workspace next
101 bindsym $mod+braceleft move container to workspace prev
102 bindsym $mod+braceright move container to workspace next
103
104 # bspwm-esque workspace switch and window move
105 bindsym $mod2+bracketleft exec sway-ws-util switch prev
106 bindsym $mod2+bracketright exec sway-ws-util switch next
107 bindsym $mod2+braceleft exec sway-ws-util move prev follow
108 bindsym $mod2+braceright exec sway-ws-util move next follow
109#
110# Moving around:
111#
112 # Move your focus around
113 bindsym $mod+$left focus left
114 bindsym $mod+$down focus down
115 bindsym $mod+$up focus up
116 bindsym $mod+$right focus right
117 # or use $mod+[up|down|left|right]
118 bindsym $mod+Left focus left
119 bindsym $mod+Down focus down
120 bindsym $mod+Up focus up
121 bindsym $mod+Right focus right
122
123 # _move_ the focused window with the same, but add Shift
124 bindsym $mod+Shift+$left move left
125 bindsym $mod+Shift+$down move down
126 bindsym $mod+Shift+$up move up
127 bindsym $mod+Shift+$right move right
128 # ditto, with arrow keys
129 bindsym $mod+Shift+Left move left
130 bindsym $mod+Shift+Down move down
131 bindsym $mod+Shift+Up move up
132 bindsym $mod+Shift+Right move right
133#
134# Workspaces:
135#
136 # switch to workspace
137 bindsym $mod+1 workspace 1
138 bindsym $mod+2 workspace 2
139 bindsym $mod+3 workspace 3
140 bindsym $mod+4 workspace 4
141 bindsym $mod+5 workspace 5
142 bindsym $mod+6 workspace 6
143 bindsym $mod+7 workspace 7
144 bindsym $mod+8 workspace 8
145 bindsym $mod+9 workspace 9
146 bindsym $mod+0 workspace 10
147 # move focused container to workspace
148 bindsym $mod+Shift+1 move container to workspace 1
149 bindsym $mod+Shift+2 move container to workspace 2
150 bindsym $mod+Shift+3 move container to workspace 3
151 bindsym $mod+Shift+4 move container to workspace 4
152 bindsym $mod+Shift+5 move container to workspace 5
153 bindsym $mod+Shift+6 move container to workspace 6
154 bindsym $mod+Shift+7 move container to workspace 7
155 bindsym $mod+Shift+8 move container to workspace 8
156 bindsym $mod+Shift+9 move container to workspace 9
157 bindsym $mod+Shift+0 move container to workspace 10
158 # Note: workspaces can have any name you want, not just numbers.
159 # We just use 1-10 as the default.
160#
161# Layout stuff:
162#
163 # You can "split" the current object of your focus with
164 # $mod+b or $mod+v, for horizontal and vertical splits
165 # respectively.
166 bindsym $mod+b splith
167 bindsym $mod+v splitv
168
169 # Switch the current container between different layout styles
170 bindsym $mod+s layout stacking
171 bindsym $mod+w layout tabbed
172 bindsym $mod+e layout toggle split
173
174 # Make the current focus fullscreen
175 bindsym $mod+f fullscreen
176
177 # Toggle sticky-ness of the current (floating) window
178 bindsym $mod+Shift+s sticky toggle
179
180 # Toggle the current focus between tiling and floating mode
181 bindsym $mod+Shift+f floating toggle
182
183 # Swap focus between the tiling area and the floating area
184 bindsym $mod+grave focus mode_toggle
185
186 # move focus to the parent container
187 bindsym $mod+a focus parent
188 bindsym $mod+Shift+a focus child
189#
190# Scratchpad:
191#
192 # Sway has a "scratchpad", which is a bag of holding for windows.
193 # You can send windows there and get them back later.
194
195 # Move the currently focused window to the scratchpad
196 bindsym $mod+Shift+minus move scratchpad
197
198 # Show the next scratchpad window or hide the focused scratchpad window.
199 # If there are multiple scratchpad windows, this command cycles through them.
200 bindsym $mod+minus scratchpad show
201#
202# Resizing containers:
203#
204mode "resize" {
205 # left will shrink the containers width
206 # right will grow the containers width
207 # up will shrink the containers height
208 # down will grow the containers height
209 bindsym $left resize shrink width 10px
210 bindsym $down resize grow height 10px
211 bindsym $up resize shrink height 10px
212 bindsym $right resize grow width 10px
213
214 # ditto, with arrow keys
215 bindsym Left resize shrink width 10px
216 bindsym Down resize grow height 10px
217 bindsym Up resize shrink height 10px
218 bindsym Right resize grow width 10px
219
220 # return to default mode
221 bindsym Return mode "default"
222 bindsym Escape mode "default"
223}
224bindsym $mod+Shift+r mode "resize"
225
226#
227# Power button
228#
229
230set $mode_system System (l)ock | (e)xit sway | (s)uspend | (h)ibernate | (r)eboot | (S)hutdown
231mode "$mode_system" {
232 bindsym l exec swaylock, mode "default"
233 bindsym e exec swaymsg exit, mode "default"
234 bindsym s exec systemctl suspend, mode "default"
235 bindsym h exec systemctl hibernate, mode "default"
236 bindsym r exec systemctl reboot, mode "default"
237 bindsym Shift+s exec systemctl poweroff -i, mode "default"
238
239 # back to normal: Enter, Escape, or q
240 bindsym Return mode "default"
241 bindsym Escape mode "default"
242 bindsym q mode "default"
243}
244# bindsym XF86PowerOff mode "$mode_system"
245bindsym $mod+Shift+e mode "$mode_system"
246bindsym XF86ScreenSaver exec swaylock
247
248#
249# Presentation mode
250#
251
252bindsym $mod+$mod2+p exec ([ ! -e ~/.nosleep ] && touch ~/.nosleep || rm ~/.nosleep) && killall -USR1 i3status
253
254#
255# Notifications
256#
257
258bindsym $mod+Shift+n mode notifications
259mode notifications {
260 bindsym Return exec makoctl invoke; exec makoctl dismiss; mode default
261 bindsym d exec makoctl dismiss; mode default
262 bindsym Shift+d exec makoctl dismiss -a; mode default
263
264 bindsym Escape mode default
265 bindsym q mode default
266}
267
268#
269# Screenshotting
270#
271
272set $mode_screenshot (a)ll | (r)egion
273mode "$mode_screenshot" {
274 bindsym a exec grim $(xdg-user-dir PICTURES)/shots/$(date +'%Y-%m-%d-%H%M%S.png'); mode default
275 bindsym r exec grim -g "$(slurp)" $(xdg-user-dir PICTURES)/shots/$(date +'%Y-%m-%d-%H%M%S.png'); mode default
276
277 bindsym Escape mode default
278 bindsym q mode default
279}
280bindsym Print mode "$mode_screenshot"
281
282#
283# Window configurations
284#
285for_window [class="mpv"] floating enable
286for_window [class="TelegramDesktop"] floating enable
287for_window [app_id="pavucontrol"] floating enable
288for_window [app_id="meld"] floating enable
289for_window [app_id="nm-connection-editor"] floating enable
290
291set $blue #285577
292set $gray #1e1f21
293set $red #900000
294
295#
296# Status Bar:
297#
298# Read `man 5 sway-bar` for more information about this section.
299bar {
300 position bottom
301 colors {
302 background $gray
303 inactive_workspace $gray $gray #888888
304 active_workspace $gray $gray #ffffff
305 urgent_workspace $red $red #ffffff
306 focused_workspace $blue $blue #ffffff
307 }
308 status_command i3status | my-i3status.py
309}
310
311client.focused $blue $blue #ffffff $blue $blue
312client.unfocused $gray $gray #ffffff $gray $gray
313client.focused_inactive $gray $gray #ffffff $gray $gray
314
315# font pango: benis uushi 9
316# font pango: Ubuntu Mono 11
317# font pango: Inconsolata 11
318font pango: DejaVu Sans Mono 9
319# font pango: Liberation Mono 9
320
321# get rid of title bars
322default_border pixel 4
323
324exec xrdb .Xresources
325# exec pgrep -x "systemd-inhibit" || \
326# systemd-inhibit --what=handle-power-key --who=aminb \
327# --why="Handle power button in sway" sleep infinity
328exec mako 2>&1 >/tmp/mako.log
329exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
330
331include /etc/sway/config.d/*
332include ~/.config/sway/`hostname`
333
334exec systemd-notify --ready || true