Kristell's Commonplace


sway

Tags:
| Desktop | | Dotfiles |

My sway configuration. I don’t use sway as of 2025-04

Autostart applications

Just put whatever you want here

exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec emacsclient --create-frame --alternate-editor=""
exec lxpolkit
exec swaync
exec swww-daemon
exec waybar
exec vesktop
exec dino
exec kontact
exec ~/.config/sway/scripts/light.sh

Variable set

Modifier key

Mod1 for alt, Mod4 for super

set $mod Mod4

Applications

The variable names don’t matter, just make sure that you know what they are when you set them.

set $term kitty
set $menu rofi -show drun
set $amen rofi -show run
set $netb qutebrowser
set $file thunar
set $tedi emacsclient --create-frame --alternate-editor=""

Key bindings

Applications

bindsym $mod+o exec $menu
# bindsym $mod+o exec env QT_QPA_PLATFORM=xcb obs
bindsym $mod+Shift+o exec $amen
bindsym $mod+Return exec $term
bindsym $mod+t exec $tedi
bindsym $mod+n exec swaync-client -t

Functions

bindsym $mod+d kill
bindsym Print exec slurp | grim -g - $HOME/johnny.decimal/10_life-management/14_digital-life/14.43_screenshots/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')
bindsym $mod+Shift+n exec systemctl restart NetworkManager

Floating windows

floating_modifier $mod normal

Reload Config

bindsym $mod+Shift+c reload

Focus

bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

Move window

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

Layout

Split

bindsym $mod+b splith
bindsym $mod+v splitv

Style

bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

Disable title bar

default_border pixel 3
default_floating_border none
font pango:monospace 10
titlebar_padding 1
titlebar_border_thickness 0

Fullscreen

bindsym $mod+f fullscreen

Float

bindsym $mod+Shift+space floating toggle

Change focus between tile and float

bindsym $mod+space focus mode_toggle

Focus parent container

bindsym $mod+a focus parent

Gaps

bindsym $mod+g exec swaymsg gaps inner all plus 3
bindsym $mod+Shift+g exec swaymsg gaps inner all minus 3
gaps inner 15px

Scratchpad

bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show

Resize mode

mode "resize" {
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Shift+r mode "resize"

Utilities:

Media control keys

Mic/Speaker

bindsym --locked XF86AudioLowerVolume exec pamixer -d 3
bindsym --locked XF86AudioMute exec pamixer -t
bindsym --locked XF86AudioRaiseVolume exec pamixer -i 3
bindsym --locked XF86AudioMicMute exec pamixer set Capture toggle

Playback

bindsym --locked XF86AudioPrev exec mpc prev
bindsym --locked XF86AudioNext exec mpc next
bindsym --locked XF86AudioPlay exec mpc toggle

Brightness

bindsym --locked XF86MonBrightnessDown exec brightnessctl set 3%-
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 3%+
include @sysconfdir@/sway/config.d/*