home-config/sway/config

72d1c1aae5c6ef87a88e81111a74d7b041c57a22 · 10.4 KB · 326 lines raw

1 # Ryan's config for sway
2 #
3 # Dependencies:
4 # waybar
5 # fuzzel
6 # light (with proper udev setting for backlight control)
7 # alacritty
8 # swaylock-effects
9 # swayidle
10 # dejavu-fonts-ttf
11 # nerd-fonts-otf
12 # noto-fonts-cjk
13 # mako / libnotify
14 # grim / slurp / wl-clipboard
15 # swaybg
16 # pipewire / pipewire-pulse / pipewire-jack / wireplumber
17 # blueman
18 # spotifyd
19 # syslog-ng
20 # OPTIONAL: wdisplays (monitor layout)
21 # ...
22
23 ### Variables
24 exec sh ~/.profile
25
26 # Load up the user session dbus
27 #exec dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus
28
29 exec hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
30
31 #
32 # Logo key. Use Mod1 for Alt.
33 set $mod Mod4
34 # Home row direction keys, like vim
35 set $left h
36 set $down j
37 set $up k
38 set $right l
39 # Your preferred terminal emulator
40 set $term alacritty
41 # Your preferred application launcher
42 # Note: pass the final command to swaymsg so that the resulting window can be opened
43 # on the original workspace that the command was run on.
44 #set $menu bemenu-run --no-exec | xargs swaymsg exec --
45 set $menu fuzzel --width=35 --font='Hack:weight=bold:size=12' --background-color='282a36fa' --selection-color='3d4460fa' --line-height=20 --border-radius=20
46
47 # Set lock screen settings
48 set $lock 'swaylock --screenshots --clock --indicator --grace 3 --fade-in 1 --effect-blur 7x5 --effect-greyscale'
49 # Same as above but no grace period
50 set $lock_now 'swaylock --screenshots --clock --indicator --fade-in 1 --effect-blur 7x5 --effect-greyscale'
51 ### Output configuration
52 #
53 # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
54 output * bg ~/.config/sway/Wallpapers/mountains.jpg fill
55 #
56 # Example configuration:
57 #
58 # output HDMI-A-1 resolution 1920x1080 position 1920,0
59 #
60 # You can get the names of your outputs by running: swaymsg -t get_outputs (moved to ~/.config/sway/monitors)
61
62 include ~/.config/sway/monitors
63
64 #output eDP-1 mode 1920x1080@60.008Hz pos 1920 590
65 #output HDMI-A-1 mode 1920x1080@74.972Hz pos 0 0
66
67 ### Idle configuration
68 #
69 # Example configuration:
70 #
71 exec swayidle -w \
72 timeout 300 $lock \
73 timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
74 before-sleep 'swaylock -f -c 000000'
75
76 # Winkey+L lock key combo
77 bindsym $mod+l exec $lock_now
78 #
79 #Winkey+Shift+L to lock then go to sleep. zzz must run with no passwd
80 bindsym $mod+Shift+l exec 'swaylock --screenshots --clock --indicator --effect-blur 7x5 --effect-greyscale & sleep 0.5; doas zzz'
81
82 # This will lock your screen after 300 seconds of inactivity, then turn off
83 # your displays after another 300 seconds, and turn your screens back on when
84 # resumed. It will also lock your screen before your computer goes to sleep.
85
86 ### Input configuration
87 #
88 # Example configuration:
89 #
90 # input "2:14:SynPS/2_Synaptics_TouchPad" {
91 # dwt enabled
92 # tap enabled
93 # natural_scroll enabled
94 # middle_emulation enabled
95 # }
96 #
97 # You can get the names of your inputs by running: swaymsg -t get_inputs
98 # Read `man 5 sway-input` for more information about this section.
99
100 gaps inner 10
101
102 ### Key bindings
103 #
104 # Basics:
105 #
106 # Start a terminal
107 bindsym $mod+Return exec $term
108
109 # Kill focused window
110 bindsym $mod+Shift+q kill
111
112 # Start your launcher
113 bindsym $mod+d exec $menu
114
115 # Drag floating windows by holding down $mod and left mouse button.
116 # Resize them with right mouse button + $mod.
117 # Despite the name, also works for non-floating windows.
118 # Change normal to inverse to use left mouse button for resizing and right
119 # mouse button for dragging.
120 floating_modifier $mod normal
121
122 # Reload the configuration file
123 bindsym $mod+Shift+c reload
124 #Restart your session
125 bindsym $mod+Shift+r restart
126
127 # Exit sway (logs you out of your Wayland session)
128 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'
129 #
130 # Moving around:
131 #
132 # Move your focus around
133 bindsym $mod+$left focus left
134 bindsym $mod+$down focus down
135 bindsym $mod+$up focus up
136 #bindsym $mod+$right focus right
137 # Or use $mod+[up|down|left|right]
138 bindsym $mod+Left focus left
139 bindsym $mod+Down focus down
140 bindsym $mod+Up focus up
141 bindsym $mod+Right focus right
142
143 # Move the focused window with the same, but add Shift
144 bindsym $mod+Shift+$left move left
145 bindsym $mod+Shift+$down move down
146 bindsym $mod+Shift+$up move up
147 #bindsym $mod+Shift+$right move right
148 # Ditto, with arrow keys
149 bindsym $mod+Shift+Left move left
150 bindsym $mod+Shift+Down move down
151 bindsym $mod+Shift+Up move up
152 bindsym $mod+Shift+Right move right
153
154 # Since I run more than one monitor most of the time, these let me move
155 # workspaces between physical screens
156 bindsym $mod+Control+Shift+Right move workspace to output right
157 bindsym $mod+Control+Shift+Left move workspace to output left
158 # Now I could do the same with up and down but I don't have any of those
159 #
160 # Workspaces:
161 #
162 # Switch to workspace
163 bindsym $mod+1 workspace number 1
164 bindsym $mod+2 workspace number 2
165 bindsym $mod+3 workspace number 3
166 bindsym $mod+4 workspace number 4
167 bindsym $mod+5 workspace number 5
168 bindsym $mod+6 workspace number 6
169 bindsym $mod+7 workspace number 7
170 bindsym $mod+8 workspace number 8
171 bindsym $mod+9 workspace number 9
172 bindsym $mod+0 workspace number 10
173 # Move focused container to workspace
174 bindsym $mod+Shift+1 move container to workspace number 1
175 bindsym $mod+Shift+2 move container to workspace number 2
176 bindsym $mod+Shift+3 move container to workspace number 3
177 bindsym $mod+Shift+4 move container to workspace number 4
178 bindsym $mod+Shift+5 move container to workspace number 5
179 bindsym $mod+Shift+6 move container to workspace number 6
180 bindsym $mod+Shift+7 move container to workspace number 7
181 bindsym $mod+Shift+8 move container to workspace number 8
182 bindsym $mod+Shift+9 move container to workspace number 9
183 bindsym $mod+Shift+0 move container to workspace number 10
184 # Note: workspaces can have any name you want, not just numbers.
185 # We just use 1-10 as the default.
186 #
187 # Layout stuff:
188 #
189 # You can "split" the current object of your focus with
190 # $mod+b or $mod+v, for horizontal and vertical splits
191 # respectively.
192 bindsym $mod+b splith
193 bindsym $mod+v splitv
194
195 # Switch the current container between different layout styles
196 bindsym $mod+s layout stacking
197 bindsym $mod+w layout tabbed
198 bindsym $mod+e layout toggle split
199
200 # Make the current focus fullscreen
201 bindsym $mod+f fullscreen
202
203 # Toggle the current focus between tiling and floating mode
204 bindsym $mod+Shift+space floating toggle
205
206 # Swap focus between the tiling area and the floating area
207 bindsym $mod+space focus mode_toggle
208
209 # Move focus to the parent container
210 bindsym $mod+a focus parent
211
212 bindsym $mod+Ctrl+Right focus sibling next
213
214 #
215 # Misc. button bindings
216 #
217 # Some custom keybinds for various keys on my laptop
218 bindsym XF86MonBrightnessUp exec light -A 10
219 bindsym XF86MonBrightnessDown exec light -U 10
220
221 #
222 # Scratchpad:
223 #
224 # Sway has a "scratchpad", which is a bag of holding for windows.
225 # You can send windows there and get them back later.
226
227 # Move the currently focused window to the scratchpad
228 bindsym $mod+Shift+minus move scratchpad
229
230 # Show the next scratchpad window or hide the focused scratchpad window.
231 # If there are multiple scratchpad windows, this command cycles through them.
232 bindsym $mod+minus scratchpad show
233 #
234 # Resizing containers:
235 #
236 mode "resize" {
237 # left will shrink the containers width
238 # right will grow the containers width
239 # up will shrink the containers height
240 # down will grow the containers height
241 bindsym $left resize shrink width 10px
242 bindsym $down resize grow height 10px
243 bindsym $up resize shrink height 10px
244 bindsym $right resize grow width 10px
245
246 # Ditto, with arrow keys
247 bindsym Left resize shrink width 10px
248 bindsym Down resize grow height 10px
249 bindsym Up resize shrink height 10px
250 bindsym Right resize grow width 10px
251
252 # Return to default mode
253 bindsym Return mode "default"
254 bindsym Escape mode "default"
255 }
256 bindsym $mod+r mode "resize"
257
258 #
259 # Status Bar:
260 #
261 # Read `man 5 sway-bar` for more information about this section.
262 #bar {
263 # position top
264 #
265 # # When the status_command prints a new line to stdout, swaybar updates.
266 # # The default just shows the current date and time.
267 # status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
268 #
269 # colors {
270 # statusline #ffffff
271 # background #323232
272 # inactive_workspace #32323200 #32323200 #5c5c5c
273 # }
274 #}
275
276 bar {
277 swaybar_command waybar
278 }
279
280
281 # Numlock on startup
282 input * xkb_numlock enabled
283
284 # Bluetooth
285 exec blueman-applet
286
287 # Audio Server
288 #exec pipewire
289 #exec wireplumber
290 #exec pipewire-pulse
291
292 # Spotifyd
293 #exec spotifyd
294
295 # Notification controls
296 exec mako
297 bindsym $mod+n exec makoctl dismiss
298 bindsym $mod+Shift+n exec makoctl dismiss -a
299
300 # Flameshot position fix and autostart
301 #exec QT_QPA_PLATFORM=wayland flameshot
302 #for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0
303
304 # Screenshots to clipboard
305 bindsym $mod+Shift+S exec grim -g "$(slurp)" - | wl-copy -t image/png
306 bindsym $mod+Print exec grim - | wl-copy -t image/png
307 #bindsym $mod+Ctrl+Shift+S exec grim -g "$(slurp)" $(echo "$HOME/Pictures/Screenshot_$(date +'%Y%m%d')_$(date +'%H%M%S').png")
308 bindsym $mod+Ctrl+Print exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
309
310 # Zathura notes window resize
311 for_window [app_id="org.pwmt.zathura" title="^.*notes.pdf$"] resize set width 775
312
313 # Syncthing start
314 exec syncthing serve --no-browser
315
316 # Force various windows to be floating
317 # Firefox PIP YT Player
318 for_window [app_id="firefox" title="^Picture-in-Picture$"] floating enable, resize set 578 326, border none, sticky enable
319 # Duo 2FA
320 for_window [app_id="firefox" title="^Activate Security Key — Mozilla Firefox$"] floating enable
321 for_window [app_id="firefox" title="^Firefox — Sharing Indicator$"] floating enable, resize set 18 52, border none, move position center, move y 0px
322 # Qjackctl
323 for_window [app_id="qjackctl"] floating enable
324 # Weather Window
325 for_window [app_id="ala-wttr"] border none, floating enable, resize set 740 712
326 include /etc/sway/config.d/*