configs/sway/config
sway/configRaw
1# Sway config file, placed at ~/.config/sway/config
2#
3# Read `man 5 sway` for a complete reference.
4
5### Variables
6#
7# Logo key. Use Mod1 for Alt.
8set $mod Mod4
9# Home row direction keys, like vim
10set $left h
11set $down j
12set $up k
13set $right l
14# Your preferred terminal emulator
15set $term alacritty
16# Your preferred application launcher
17set $menu wmenu-run
18
19### Output configuration
20#
21# Default wallpaper (more resolutions are available in /run/current-system/sw/share/backgrounds/sway/)
22# output * bg /run/current-system/sw/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
23output * bg ~/Sync-tablet/wallpapers/geometry02_croped1920x1080.png fill
24#
25# Example configuration:
26#
27# output HDMI-A-1 resolution 1920x1080 position 1920,0
28#
29# You can get the names of your outputs by running: swaymsg -t get_outputs
30
31# home setup:
32output HDMI-A-1 resolution 3840x2160 position 1920 0
33# output eDP-1 resolution 1920x1200 position 0 0 transform 90
34output DSI-1 resolution 1920x1200 position 0 0 transform 90
35# output DSI-1 position 0 0
36output DP-2 resolution 1920x1200 position 1920 0
37
38# portable external monitor setup:
39# output DP-1 resolution 3840x2160 position 1920 0
40# output eDP-1 resolution 1920x1200 position 0 0
41# output DP-1 {
42# transform 270
43# }
44
45
46# move current workspace to another display
47# bindsym $mod+Control+k move workspace to output HDMI-A-1
48# bindsym $mod+Control+j move workspace to output eDP-1
49# bindsym $mod+Control+j move workspace to output DP-1
50# bindsym $mod+Control+k move workspace to output eDP-1
51# bindsym $mod+Control+k move workspace to output DP-1
52bindsym $mod+Control+j move workspace to output DSI-1
53bindsym $mod+Control+k move workspace to output DP-1
54
55
56### Idle configuration
57#
58# Example configuration:
59#
60# exec swayidle -w \
61# timeout 300 'swaylock -f -c 000000' \
62# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
63# before-sleep 'swaylock -f -c 000000'
64#
65# This will lock your screen after 300 seconds of inactivity, then turn off
66# your displays after another 300 seconds, and turn your screens back on when
67# resumed. It will also lock your screen before your computer goes to sleep.
68
69# lock screen
70bindsym $mod+Control+l exec swaylock -i ~/Sync/wallpapers/geometry02_croped1920x1080_pixelized.png -c 000000
71
72bindsym $mod+Control+d exec poweroff
73
74### Input configuration
75#
76# Example configuration:
77#
78# input "2:14:SynPS/2_Synaptics_TouchPad" {
79# dwt enabled
80# tap enabled
81# natural_scroll enabled
82# middle_emulation enabled
83# }
84#
85# You can get the names of your inputs by running: swaymsg -t get_inputs
86# Read `man 5 sway-input` for more information about this section.
87
88### Key bindings
89#
90# Basics:
91#
92 # Start a terminal
93 bindsym $mod+Return exec $term
94
95 # Kill focused window
96 bindsym $mod+Shift+q kill
97
98 # Start your launcher
99 bindsym $mod+d exec $menu
100
101 # Drag floating windows by holding down $mod and left mouse button.
102 # Resize them with right mouse button + $mod.
103 # Despite the name, also works for non-floating windows.
104 # Change normal to inverse to use left mouse button for resizing and right
105 # mouse button for dragging.
106 floating_modifier $mod normal
107
108 # Reload the configuration file / restart sway from config file
109 bindsym $mod+Shift+c reload
110
111 # Exit sway (logs you out of your Wayland session)
112 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'
113#
114# Moving around:
115#
116 # Move your focus around
117 bindsym $mod+$left focus left
118 bindsym $mod+$down focus down
119 bindsym $mod+$up focus up
120 bindsym $mod+$right focus right
121 # Or use $mod+[up|down|left|right]
122 bindsym $mod+Left focus left
123 bindsym $mod+Down focus down
124 bindsym $mod+Up focus up
125 bindsym $mod+Right focus right
126
127 # Move the focused window with the same, but add Shift
128 bindsym $mod+Shift+$left move left
129 bindsym $mod+Shift+$down move down
130 bindsym $mod+Shift+$up move up
131 bindsym $mod+Shift+$right move right
132 # Ditto, with arrow keys
133 bindsym $mod+Shift+Left move left
134 bindsym $mod+Shift+Down move down
135 bindsym $mod+Shift+Up move up
136 bindsym $mod+Shift+Right move right
137#
138# Workspaces:
139#
140 # Switch to workspace
141 bindsym $mod+1 workspace number 1
142 bindsym $mod+2 workspace number 2
143 bindsym $mod+3 workspace number 3
144 bindsym $mod+4 workspace number 4
145 bindsym $mod+5 workspace number 5
146 bindsym $mod+6 workspace number 6
147 bindsym $mod+7 workspace number 7
148 bindsym $mod+8 workspace number 8
149 bindsym $mod+9 workspace number 9
150 bindsym $mod+0 workspace number 10
151 # Move focused container to workspace
152 bindsym $mod+Shift+1 move container to workspace number 1
153 bindsym $mod+Shift+2 move container to workspace number 2
154 bindsym $mod+Shift+3 move container to workspace number 3
155 bindsym $mod+Shift+4 move container to workspace number 4
156 bindsym $mod+Shift+5 move container to workspace number 5
157 bindsym $mod+Shift+6 move container to workspace number 6
158 bindsym $mod+Shift+7 move container to workspace number 7
159 bindsym $mod+Shift+8 move container to workspace number 8
160 bindsym $mod+Shift+9 move container to workspace number 9
161 bindsym $mod+Shift+0 move container to workspace number 10
162 # Note: workspaces can have any name you want, not just numbers.
163 # We just use 1-10 as the default.
164#
165# Layout stuff:
166#
167 # You can "split" the current object of your focus with
168 # $mod+b or $mod+v, for horizontal and vertical splits
169 # respectively.
170 bindsym $mod+b splith
171 bindsym $mod+v splitv
172
173 # Switch the current container between different layout styles
174 bindsym $mod+s layout stacking
175 bindsym $mod+w layout tabbed
176 bindsym $mod+e layout toggle split
177
178 # Make the current focus fullscreen
179 bindsym $mod+f fullscreen
180
181 # Toggle the current focus between tiling and floating mode
182 bindsym $mod+Shift+space floating toggle
183
184 # Swap focus between the tiling area and the floating area
185 bindsym $mod+space focus mode_toggle
186
187 # Move focus to the parent container
188 bindsym $mod+a focus parent
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+r mode "resize"
225#
226# Utilities:
227#
228 # Special keys to adjust volume via PulseAudio
229 bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
230 bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
231 bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
232 bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
233 # Special keys to adjust brightness via brightnessctl
234 bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
235 bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
236 # Special key to take a screenshot with grim
237 bindsym Print exec grim
238
239#
240# Status Bar:
241#
242# Read `man 5 sway-bar` for more information about this section.
243bar {
244 position bottom
245 status_command while ~/.config/sway/status.sh; do sleep 1; done
246
247 # When the status_command prints a new line to stdout, swaybar updates.
248 # The default just shows the current date and time.
249 # status_command while date +'%Y-%m-%d %X'; do sleep 1; done
250
251 colors {
252 statusline #ffffff
253 background #000000
254 inactive_workspace #32323200 #32323200 #5c5c5c
255 }
256}
257
258default_border pixel 1
259
260# shortcut to switch regular/bold font in alacritty configuration
261bindsym $mod+Control+b exec sed -i 's/\"Regular\"#tag_for_shortcut/\"Bold\"#tag_for_shortcut/g' ~/.config/alacritty/alacritty.toml
262bindsym $mod+Control+Shift+b exec sed -i 's/\"Bold\"#tag_for_shortcut/\"Regular\"#tag_for_shortcut/g' ~/.config/alacritty/alacritty.toml
263
264input type:keyboard {
265 xkb_layout us
266 # xkb_options:
267 # - ctrl:nocaps = remap capslock to control
268 # - compose:ralt = special characters, ie.
269 # RightAlt, comma, c = ç
270 # RightAlt, equal, c = €
271 # RightAlt, ~, n = ñ
272 xkb_options "ctrl:nocaps,compose:ralt"
273}
274
275# battery warning, check every 60 seconds, warning message every 3 minutes:
276exec --no-startup-id ~/.config/sway/battery-warning.sh
277
278# for screen sharing
279#exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
280#exec dbus-update-activation-environment WAYLAND_DISPLAY
281
282# systemctl --user daemon-reexec
283# systemctl --user restart pipewire
284# systemctl --user restart xdg-desktop-portal
285# systemctl --user restart xdg-desktop-portal-wlr
286
287include /etc/sway/config.d/*