blob: 96400f675cf951baeab226f721a196be80b66579 [file] [log] [blame]
Copybara botca5ce642024-11-08 17:38:08 +01001# Read `man 5 sway` for a complete reference.
2
3### Variables
4#
5# Logo key. Use Mod1 for Alt.
6set $mod Mod4
7# Home row direction keys, like vim
8set $left h
9set $down j
10set $up k
11set $right l
12# Your preferred terminal emulator
13set $term foot
14# Your preferred application launcher
15# Note: pass the final command to swaymsg so that the resulting window can be opened
16# on the original workspace that the command was run on.
17#set $menu dmenu_path | wmenu | xargs swaymsg exec --
18set $menu rofi -show drun | xargs swaymsg exec --
19set $menuDrun rofi -show run | xargs swaymsg exec --
20set $menuSsh rofi -show ssh | xargs swaymsg exec --
21set $menuWindows rofi -show window | xargs swaymsg exec --
22set $menuPower rofi -show power-menu -modi power-menu:rofi-power-menu | xargs swaymsg exec --
23set $menuClipboard rofi -show clipboard -modi clipboard:~/bin/cliphist-rofi-img -show-icons | xargs swaymsg exec --
24
Adrià Vilanova533fa8a2024-10-06 19:19:20 +020025{{ if eq .chezmoi.hostname "pixelbook" -}}
Copybara botca5ce642024-11-08 17:38:08 +010026set $internalScreen "Sharp Corporation LQ123P1JX32 Unknown"
Copybara botca5ce642024-11-08 17:38:08 +010027
28set $internalKeyboard "4012:2782:keyd_virtual_keyboard"
Adrià Vilanova533fa8a2024-10-06 19:19:20 +020029{{- end }}
30{{ if eq .env "work" -}}
31set $internalScreen "Chimei Innolux Corporation 0x143F Unknown"
32set $P12GRAN304Screen "Dell Inc. DELL P2214H 29C293AA1DRL"
33
34set $internalKeyboard "1:1:AT_Translated_Set_2_keyboard"
35{{- end }}
36
37set $auxScreen "LG Electronics LG Ultra HD 0x0000D4DC"
Adrià Vilanova Martínez45f04e12024-11-19 20:43:24 +010038set $portableScreen "GWD ARZOPA 000000000000"
39
40set $internalKeyboard "4012:2782:keyd_virtual_keyboard"
Copybara botca5ce642024-11-08 17:38:08 +010041set $macKeyboard "1452:598:Apple_Wireless_Keyboard"
Copybara botca5ce642024-11-08 17:38:08 +010042
43### Output configuration
44#
45# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
46output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536.png fill
47#
48# Example configuration:
49#
50# output HDMI-A-1 resolution 1920x1080 position 1920,0
51#
52# You can get the names of your outputs by running: swaymsg -t get_outputs
53
54{{ if eq .chezmoi.hostname "pixelbook" -}}
55output $internalScreen {
56 mode 2400x1600@59.982Hz
Adrià Vilanova Martínez45f04e12024-11-19 20:43:24 +010057 pos 0 165
58 scale 1.75
Copybara botca5ce642024-11-08 17:38:08 +010059}
60
61output $auxScreen {
62 mode 1920x1080@60.000Hz
Adrià Vilanova Martínez45f04e12024-11-19 20:43:24 +010063 pos 1372 0
64}
65
66output $portableScreen {
67 mode 1920x1080@60.000Hz
68 pos -1920 0
Copybara botca5ce642024-11-08 17:38:08 +010069}
70
71workspace 1 output $internalScreen
72workspace 10 output $auxScreen $internalScreen
73{{- end }}
74
Adrià Vilanova533fa8a2024-10-06 19:19:20 +020075{{ if eq .env "work" -}}
76output $internalScreen {
77 mode 1920x1200@60.003Hz
78 pos 1920 0
79}
80
81output $auxScreen {
82 mode 1920x1080@60.000Hz
83 pos 3840 0
84}
85
86output $P12GRAN304Screen {
87 mode 1920x1080@60.000Hz
88 pos 0 0
89}
90{{- end }}
91
Copybara botca5ce642024-11-08 17:38:08 +010092### Idle configuration
93#
94# Example configuration:
95#
96# exec swayidle -w \
97# timeout 300 'swaylock -f -c 000000' \
98# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
99# before-sleep 'swaylock -f -c 000000'
100#
101# This will lock your screen after 300 seconds of inactivity, then turn off
102# your displays after another 300 seconds, and turn your screens back on when
103# resumed. It will also lock your screen before your computer goes to sleep.
104
105### Input configuration
106#
107# Example configuration:
108#
109# input "2:14:SynPS/2_Synaptics_TouchPad" {
110# dwt enabled
111# tap enabled
112# natural_scroll enabled
113# middle_emulation enabled
114# }
115#
116# You can get the names of your inputs by running: swaymsg -t get_inputs
117# Read `man 5 sway-input` for more information about this section.
118
119### Key bindings
120#
121# Basics:
122#
123 # Start a terminal
124 bindsym $mod+Return exec $term
125
126 # Kill focused window
127 bindsym $mod+Shift+q kill
128
129 # Start the launcher launcher
130 bindsym $mod+d exec $menu
131
132 # Other menus
133 bindsym $mod+Shift+d exec $menuDrun
134 bindsym $mod+g exec $menuSsh
135 bindsym $mod+Shift+g exec $menuWindows
136 bindsym $mod+c exec $menuClipboard
137 bindsym $mod+Shift+s exec $menuPower
138
139 # Drag floating windows by holding down $mod and left mouse button.
140 # Resize them with right mouse button + $mod.
141 # Despite the name, also works for non-floating windows.
142 # Change normal to inverse to use left mouse button for resizing and right
143 # mouse button for dragging.
144 floating_modifier $mod normal
145
146 # Reload the configuration file
147 bindsym $mod+Shift+c reload
148
149 # Exit sway (logs you out of your Wayland session)
150 bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
151#
152# Moving around:
153#
154 # Move your focus around
155 bindsym $mod+$left focus left
156 bindsym $mod+$down focus down
157 bindsym $mod+$up focus up
158 bindsym $mod+$right focus right
159 # Or use $mod+[up|down|left|right]
160 bindsym $mod+Left focus left
161 bindsym $mod+Down focus down
162 bindsym $mod+Up focus up
163 bindsym $mod+Right focus right
164
165 # Move the focused window with the same, but add Shift
166 bindsym $mod+Shift+$left move left
167 bindsym $mod+Shift+$down move down
168 bindsym $mod+Shift+$up move up
169 bindsym $mod+Shift+$right move right
170 # Ditto, with arrow keys
171 bindsym $mod+Shift+Left move left
172 bindsym $mod+Shift+Down move down
173 bindsym $mod+Shift+Up move up
174 bindsym $mod+Shift+Right move right
175#
176# Workspaces:
177#
178 # Switch to workspace
179 bindsym $mod+1 workspace number 1
180 bindsym $mod+2 workspace number 2
181 bindsym $mod+3 workspace number 3
182 bindsym $mod+4 workspace number 4
183 bindsym $mod+5 workspace number 5
184 bindsym $mod+6 workspace number 6
185 bindsym $mod+7 workspace number 7
186 bindsym $mod+8 workspace number 8
187 bindsym $mod+9 workspace number 9
188 bindsym $mod+0 workspace number 10
189 # Move focused container to workspace
190 bindsym $mod+Shift+1 move container to workspace number 1
191 bindsym $mod+Shift+2 move container to workspace number 2
192 bindsym $mod+Shift+3 move container to workspace number 3
193 bindsym $mod+Shift+4 move container to workspace number 4
194 bindsym $mod+Shift+5 move container to workspace number 5
195 bindsym $mod+Shift+6 move container to workspace number 6
196 bindsym $mod+Shift+7 move container to workspace number 7
197 bindsym $mod+Shift+8 move container to workspace number 8
198 bindsym $mod+Shift+9 move container to workspace number 9
199 bindsym $mod+Shift+0 move container to workspace number 10
Adrià Vilanova533fa8a2024-10-06 19:19:20 +0200200 # Move workspaces around outputs
201 bindsym $mod+Control+Shift+$right move workspace to output right
202 bindsym $mod+Control+Shift+$left move workspace to output left
203 bindsym $mod+Control+Shift+$down move workspace to output down
204 bindsym $mod+Control+Shift+$up move workspace to output up
205 bindsym $mod+Control+Shift+Right move workspace to output right
206 bindsym $mod+Control+Shift+Left move workspace to output left
207 bindsym $mod+Control+Shift+Down move workspace to output down
208 bindsym $mod+Control+Shift+Up move workspace to output up
Copybara botca5ce642024-11-08 17:38:08 +0100209 # Note: workspaces can have any name you want, not just numbers.
210 # We just use 1-10 as the default.
211#
212# Layout stuff:
213#
214 # You can "split" the current object of your focus with
215 # $mod+b or $mod+v, for horizontal and vertical splits
216 # respectively.
217 bindsym $mod+b splith
218 bindsym $mod+v splitv
219
220 # Switch the current container between different layout styles
221 bindsym $mod+s layout stacking
222 bindsym $mod+w layout tabbed
223 bindsym $mod+e layout toggle split
224
225 # Make the current focus fullscreen
226 bindsym $mod+f fullscreen
227
228 # Toggle the current focus between tiling and floating mode
229 bindsym $mod+Shift+space floating toggle
230
231 # Swap focus between the tiling area and the floating area
232 bindsym $mod+space focus mode_toggle
233
234 # Move focus to the parent container
235 bindsym $mod+a focus parent
236#
237# Scratchpad:
238#
239 # Sway has a "scratchpad", which is a bag of holding for windows.
240 # You can send windows there and get them back later.
241
242 # Move the currently focused window to the scratchpad
243 bindsym $mod+Shift+minus move scratchpad
244
245 # Show the next scratchpad window or hide the focused scratchpad window.
246 # If there are multiple scratchpad windows, this command cycles through them.
247 bindsym $mod+minus scratchpad show
248
249#
250# Custom keybindings:
251#
252 bindsym Control+Shift+Comma exec flatpak run it.mijorus.smile
253
254# Sound
255 bindsym XF86AudioRaiseVolume exec wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+
256 bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
257 bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
258 bindsym XF86AudioPlay exec playerctl play-pause
259 bindsym XF86AudioPause exec playerctl play-pause
260 bindsym XF86AudioNext exec playerctl next
261 bindsym XF86AudioPrev exec playerctl previous
262
263# Brightness
264 bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
265 bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
266 bindsym Alt+XF86MonBrightnessDown exec brightnessctl --device='chromeos::kbd_backlight' set 5%-
267 bindsym Alt+XF86MonBrightnessUp exec brightnessctl --device='chromeos::kbd_backlight' set 5%+
268
269# Menu
270 bindsym XF86Tools exec $menu
271 bindsym XF86LaunchB exec $menu
272
273# Notifications
274 bindsym $mod+X exec makoctl dismiss
275 bindsym $mod+Shift+X exec makoctl restore
276 bindsym $mod+Z exec makoctl dismiss -a
277
278#
279# Resizing containers:
280#
281mode "resize" {
282 # left will shrink the containers width
283 # right will grow the containers width
284 # up will shrink the containers height
285 # down will grow the containers height
286 bindsym $left resize shrink width 10px
287 bindsym $down resize grow height 10px
288 bindsym $up resize shrink height 10px
289 bindsym $right resize grow width 10px
290
291 # Ditto, with arrow keys
292 bindsym Left resize shrink width 10px
293 bindsym Down resize grow height 10px
294 bindsym Up resize shrink height 10px
295 bindsym Right resize grow width 10px
296
297 # Return to default mode
298 bindsym Return mode "default"
299 bindsym Escape mode "default"
300}
301bindsym $mod+r mode "resize"
302
303#
304# Status Bar:
305#
306# Read `man 5 sway-bar` for more information about this section.
307bar {
308 position top
309
310 status_command SCRIPT_DIR=~/.config/i3blocks i3blocks
311
312 colors {
313 statusline #ffffff
314 background #323232
315 inactive_workspace #32323200 #32323200 #5c5c5c
316 }
317}
318
319include /etc/sway/config.d/*
320
321input type:touchpad {
322 tap enabled
323 natural_scroll enabled
324}
325
326input type:pointer {
327 natural_scroll enabled
328}
329
330{{ if eq .chezmoi.hostname "pixelbook" -}}
331input $internalKeyboard {
332 xkb_layout us,es
333 xkb_options grp:rctrl_toggle
334}
335
Copybara botca5ce642024-11-08 17:38:08 +0100336input type:tablet_tool {
337 map_to_output $internalScreen
338}
339
340input type:touch {
341 map_to_output $internalScreen
342}
343{{- end }}
Adrià Vilanova533fa8a2024-10-06 19:19:20 +0200344{{ if eq .env "work" -}}
345input type:keyboard {
346 xkb_layout es,us
347 xkb_options grp:alt_space_toggle
348}
349
350input $internalKeyboard {
351 xkb_layout es,us
352 xkb_options grp:alt_space_toggle
353}
354{{- end }}
355
356input $macKeyboard {
357 xkb_layout es,us
358 xkb_options grp:rwin_toggle
359}
Copybara botca5ce642024-11-08 17:38:08 +0100360
361font pango:monospace 10
362
363# @source: https://www.reddit.com/r/swaywm/comments/16nutle/comment/k1ig9b6/
364# @source: https://gitlab.com/that1communist/dotfiles/-/blob/master/.config/sway/modules/win-rules
365# NOTE: You can get app_id's with `swaymsg -t get_tree`
366for_window {
367 [window_role="pop-up"] floating enable
368 [window_role="About"] floating enable
369 [window_role="bubble"] floating enable
370 [window_role="dialog"] floating enable
371 [window_type="dialog"] floating enable
372
373 [title="(?:Open|Save) (?:File|Folder|As)"] floating enable, resize set width 1030 height 710
374
375 [app_id="org.gnome.Calculator"] floating enable
376 [app_id="it.mijorus.smile"] floating enable
377 # See https://wiki.archlinux.org/index.php?title=Flameshot&oldid=813985#Flameshot_does_not_work_on_all_monitors_of_a_multi-monitor_setup_in_Sway
Adrià Vilanova Martínez45f04e12024-11-19 20:43:24 +0100378{{ if eq .chezmoi.hostname "pixelbook" -}}
Copybara botca5ce642024-11-08 17:38:08 +0100379 [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0
Adrià Vilanova Martínez45f04e12024-11-19 20:43:24 +0100380{{- else -}}
381 [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0
382{{- end }}
Copybara botca5ce642024-11-08 17:38:08 +0100383
384 [title=".* is sharing your screen"] move window to scratchpad
385 [app_id="chrome-pjibgclleladliembfgfagdaldikeohf-.*"] move window to workspace 10; workspace 10
386 [app_id="chrome-aoocenepihlidnmnheodnngihilbadfo-.*"] move window to workspace 10; workspace 10
387}
388
389exec mako
390
391# See https://github.com/emersion/xdg-desktop-portal-wlr/blob/d9ada849aeca6137915de2df69beaef4e272cc1d/README.md#running
392exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
393
394# See https://github.com/flameshot-org/flameshot/blob/14a136777cd82ab70f42c13b4bc9418c756d91d2/docs/Sway%20and%20wlroots%20support.md
395exec SDL_VIDEODRIVER=wayland _JAVA_AWT_WM_NONREPARENTING=1 QT_QPA_PLATFORM=wayland XDG_CURRENT_DESKTOP=sway XDG_SESSION_DESKTOP=sway flameshot
396
Adrià Vilanova Martínezfccd64d2024-11-19 20:43:24 +0100397exec wl-paste --watch cliphist store -max-items 10
Copybara botca5ce642024-11-08 17:38:08 +0100398
399# See https://wiki.archlinux.org/title/Sway#Idle
400exec swayidle -w \
401 timeout 235 'swaymsg "output * power off"' \
402 resume 'swaymsg "output * power on"' \
403 timeout 240 'swaylock -f' \
404 timeout 300 'systemctl sleep' \
405 before-sleep 'playerctl pause; swaylock -f'