5.0 KiB
Sway Config
Variables
Logo key
set $mod Mod4
Movement
set $left h
set $down j
set $up k
set $right l
Some default programs
set $term exec termite
set $menu exec dmenu_run
Window Borders
default_border pixel 0
default_floating_border normal
Layouts
Changing the container layout
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
Focus
Change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
Focus the parent container
bindsym $mod+a focus parent
Workspaces
Define name for default workspaces for which key bindings will be configured. Use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
Switching to workspaces
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
Input Configurations
Swap `ctrl` for `caps lock`
input * {
xkb_options ctrl:swapcaps
}
input * xkb_numlock enable
Theme
class border background text indicator child-border
client.focused #C0C5CE #C0C5CE #1B2229 #C0C5CE #C0C5CE
client.focused_inactive #232830 #232830 #C0C5CE #232830 #232830
client.unfocused #1B2229 #1B2229 #C0C5CE #1B2229 #1B2229
client.urgent #65737E #65737E #D08770 #65737E #65737E
client.placeholder #4F5B66 #4F5B66 #D08770 #4F5B66 #4F5B66
client.background #2B303B
Idle
Lock the screen after 600 seconds of inactivity, then turn off the display after another 600 seconds. Turn on the screen when resumed. Lock the screen before the computer goes to sleep too.
exec swayidle -w \
timeout 600 'swaylock' \
timeout 1200 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock'
Keybindings
Basics
bindsym $mod+Shift+q kill
bindsym $mod+Shift+c reload
bindsym $mod+Shift+e exit
floating_modifier $mod normal
Focusing
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
Move the focused 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
Resizing
mode "resize" {
bindsym $left resize shrink width 1 px or 1 ppt
bindsym $down resize grow height 1 px or 1 ppt
bindsym $up resize shrink height 1 px or 1 ppt
bindsym $right resize grow width 1 px or 1 ppt
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
Sway has a "scratchpad", which is a bag of holding for windows. Windows can be sent there and back later.
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
I run emacs as a server. I have keybindings to run specific programs in their own frame.
bindsym $mod+grave exec emacsclient -c -a ''
bindsym $mod+Shift+b exec emacsclient -c -a '' -F '(quote (name . "buffers"))' --eval '(ibuffer)'
bindsym $mod+Shift+d exec emacsclient -c -a '' -F '(quote (name . "dired"))' --eval '(dired nil)'
bindsym $mod+Shift+f exec emacsclient -c -a '' -F '(quote (name . "feeds"))' --eval '(elfeed)'
bindsym $mod+Shift+s exec emacsclient -c -a '' -F '(quote (name . "eshell"))' --eval '(eshell)'