summaryrefslogtreecommitdiff
path: root/.config/sway/config
blob: b2ea0a32a167474b410bdfb8e283334438199af0 (plain)
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
set $mod Mod4
set $left h
set $down j
set $up k
set $right l
set $term kitty
set $menu fuzzel
set $dmenu fuzzel -d
set $file_manager pcmanfm-qt

default_border pixel 2
default_floating_border pixel 2
titlebar_border_thickness 2
titlebar_padding 6 4

smart_gaps off
smart_borders off

gaps inner 0
gaps outer 0

hide_edge_borders none
show_marks yes

focus_follows_mouse no
focus_on_window_activation smart

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃                         Outputs                         ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

output * bg ~/.wallpaper fill
output "Chimei Innolux Corporation 0x142B Unknown" {
  mode 1920x1080@60Hz
  pos 0 0
  scale 1.25
}

output 'Acer Technologies EK220Q H3 14301552C3W01' {
  mode 1920x1080@100Hz
	pos -1920 0
}

output * scale_filter nearest

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃                         Inputs                          ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

# MSI touchpad
input "1267:12930:PNP0C50:00_04F3:3282_Touchpad" {
  natural_scroll enabled
	pointer_accel 0
	dwt enabled # disable while typing
	tap enabled # touch click also works with physical click
	click_method clickfinger
	scroll_method two_finger
}

input "type:keyboard" {
	# swap capslock key to escape key
	xkb_options caps:escape
  repeat_delay 200
  repeat_rate 30
}

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃                         Keybinds                        ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

# Open terminal
bindsym $mod+Return exec $term

# Kill focused window
bindsym $mod+q kill

# Start your launcher
bindsym $mod+Space exec $menu

# File manager
bindsym $mod+e exec $file_manager

# Open ungoogled chromium
bindsym $mod+b exec /usr/bin/chromium \
			--force-dark-mode \
			--enable-features=WebUIDarkMode

bindsym $mod+Shift+b exec /usr/bin/librewolf

# Reload the configuration file
bindsym $mod+Shift+c reload

# Power menu
bindsym $mod+p exec ~/.local/bin/sway-power

# Recall last notifications
bindsym $mod+grave       exec makoctl restore

# Exit sway
bindsym $mod+Shift+e exec swaynag -e bottom \
			  -m 'EXIT SWAY SESSION' \
			  -b '		YES		' 'swaymsg exit' \
			  -s '		NO		'

# === Display ===

# Lid close handling
bindswitch --reload --locked lid:on output eDP-1 disable
bindswitch --reload --locked lid:off output eDP-1 enable

# === Navigation ===

# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# === Workspaces ===

# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10

# Make the current focus fullscreen
bindsym $mod+f fullscreen

# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle

# === Resizing containers ===

mode "resize" {
    # left will shrink the containers width
    # right will grow the containers width
    # up will shrink the containers height
    # down will grow the containers height
    bindsym $left resize shrink width 10px
    bindsym $down resize grow height 10px
    bindsym $up resize shrink height 10px
    bindsym $right resize grow width 10px

    # Ditto, with arrow keys
    bindsym Left resize shrink width 10px
    bindsym Down resize grow height 10px
    bindsym Up resize shrink height 10px
    bindsym Right resize grow width 10px

    # Return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

# Switch to previous workspace
bindsym $mod+bracketleft workspace prev
bindcode --whole-window $mod+275 workspace prev

# Switch to next workspace
bindsym $mod+bracketright workspace next
bindcode --whole-window $mod+276 workspace next

# Split view horizontally
bindsym $mod+equal slith

# Split view vertically
bindsym $mod+minus slitv

# === Layouts ===

# Activate stacking layout
bindsym $mod+Shift+s layout stacking

# Activate tabbed layout
bindsym $mod+t layout tabbed

# Toggle split layout
bindsym $mod+s layout toggle split


# === Media keys ===

# Switching to use with Pipewire
bindsym --locked XF86AudioRaiseVolume exec wpctl set-volume -l 1.5 \@DEFAULT_AUDIO_SINK@ 5%+
bindsym --locked XF86AudioLowerVolume exec wpctl set-volume -l 1.5 \@DEFAULT_AUDIO_SINK@ 5%-
bindsym --locked XF86AudioMute exec wpctl set-mute \@DEFAULT_AUDIO_SINK@ toggle
bindsym --locked XF86AudioMicMute exec wpctl set-mute \@DEFAULT_AUDIO_SOURCE@ toggle

# Special keys to control media via playerctl
bindsym --locked XF86AudioPlay exec playerctl play-pause
bindsym --locked XF86AudioPause exec playerctl play-pause
bindsym --locked XF86AudioPrev exec playerctl previous
bindsym --locked XF86AudioNext exec playerctl next
bindsym --locked XF86AudioStop exec playerctl stop

# Special keys to adjust brightness via brightnessctl
bindsym --locked XF86MonBrightnessDown exec brightnessctl set -e1 -n2 5%-
bindsym --locked XF86MonBrightnessUp exec brightnessctl set -e1 -n2 5%+
bindsym --locked $mod+XF86MonBrightnessDown exec ~/.local/bin/waybar-brightness down
bindsym --locked $mod+XF86MonBrightnessUp exec ~/.local/bin/waybar-brightness up

# === Clipboard ===

# Open clipboard (copying)
bindsym $mod+v exec cliphist list \
		    | $dmenu \
		    | cliphist decode \
		    | wl-copy

# Open clipboard (deleting)
bindsym $mod+Shift+v exec cliphist list \
		     | $dmenu \
		     | cliphist delete

# === Screenshot ===

# Screenshot whole screen
bindsym Print                 exec --no-startup-id ~/.local/bin/screenshot

# Screenshot region of screen
bindsym Shift+Print           exec --no-startup-id ~/.local/bin/screenshot region

# Screenshot current window
bindsym Ctrl+Print            exec --no-startup-id ~/.local/bin/screenshot window

# Parse text on screen and copy to clipboard
bindsym $mod+Print            exec --no-startup-id slurp \
                              | xargs -I {} grim -s 2 -t png -g {} - \
                              | tesseract - - \
                              | wl-copy -n

# wlsunset toggle
bindsym $mod+n								exec pgrep wlsunset \
																&& pkill wlsunset \
																|| wlsunset -T 4500

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃                     Window Rules                    		┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

floating_modifier $mod normal

set {
	$float floating enable; shadows enable; border pixel 2
	$float_resize floating enable; resize set 900 800 px; border pixel 2
	$popup floating enable; sticky enable; shadows enable
}

for_window [app_id = "floating"] $float
for_window [app_id = "floating_update"] $float
for_window [title = "^Open File$"] $float_resize
for_window [title = "^Save File$"] $float_resize
for_window [app_id = "mpv"] $float_resize
for_window [app_id = "pavucontrol"] $float_resize
for_window [app_id = "TUI.float"] $float_resize
for_window [app_id="firefox" title="^Picture-in-Picture$"] $popup
for_window [app_id="" title="^Picture in Picture$"] $popup
for_window [title="^launcher$"] $float_resize
for_window [app_id="hayase"] inhibit_idle fullscreen

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃                         Status bar                      ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

no_focus [app_id="waybar"]
for_window [app_id="waybar" floating] {
	move position cursor
	move down 60px
}
focus_on_window_activation focus

bar {
  id mainbar
  output *
  swaybar_command waybar
}

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃                         Autostarts                      ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

seat * xcursor_theme Vimix-White 32
exec gsettings set org.gnome.desktop.interface cursor-theme Vimix-White
exec gsettings set org.gnome.desktop.interface cursor-size 32

# Services

# DBUS
exec dbus-update-activation-environment \
  --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway

# swayidle
exec swayidle -w \
  timeout 600 'swaylock --daemonize' \
  timeout 900 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
  before-sleep 'swaylock --daemonize'

# wlsunset
# exec wlsunset -l '23.36' -L '85.33'

# poweralertd
exec poweralertd

# clipboard
exec wl-paste --type text --watch cliphist store
exec wl-paste --type image --watch cliphist store

# NOTE: Facing a lot of issues with `gnome-keyring`
# Have decided not use `gnome-keyring`

# Gnome keyring
# also required to add into /etc/pam.d/login to autostart and unlock from TTY
# auth       optional	 pam_gnome_keyring.so
# session    optional     pam_gnome_keyring.so auto_start
exec gnome-keyring-daemon --start --components=secrets

# Desktop notification
exec mako

# === Other configs ===

include /etc/sway/config.d/*