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