Sway Wayland tiling compositor

Version 1.11 · source

Start here

Mod+Enter
Open a terminal
Mod+d
Launch an app
Mod+Arrows
Focus a neighbour
Mod+1-9
Switch workspace
Mod+Shift+1-9
Send window to workspace
Mod+f
Toggle fullscreen
Mod+Shift+q
Close the window
Mod+Shift+c
Reload the config

Concepts

Output a monitor
Workspace one named desktop
Container split, stacked or tabbed
Window leaf of the tree

Focus

Mod+Arrows
Focus left / down / up / right
Mod+h, j, k, l do the same: left, down, up, right.
Mod+a
Focus parent container
Press again to climb further; focus child steps back down.
Mod+Space
Toggle focus tiling / floating
Mod+Shift+q
Kill focused window
focus output <dir>
Focus another monitor
[app_id="<name>"] focus
Jump to a window by criteria
Use in a bindsym or via swaymsg. Native Wayland apps match app_id; XWayland apps match class.

Move Windows

Mod+Shift+Arrows
Move window left / down / up / right
Mod+Shift+h, j, k, l do the same.
Mod+Shift+1-9
Move window to workspace
move container to output <dir>
Send window to another monitor
swap container with con_id <id>
Swap two windows
mark --add <name>
Tag the focused window
move container to mark <name>
Send window to a marked one

Layouts and Splits

Mod+b
Next window opens beside this one
Mod+v
Next window opens below this one
Mod+f
Toggle fullscreen
Mod+s
Stacking layout
Mod+w
Tabbed layout
Mod+e
Toggle split layout, h / v
layout toggle all
Cycle through every layout
gaps inner all set <px>
Change gaps at runtime

Workspaces

Mod+1-9
Switch to workspace N
Mod+0 goes to workspace 10.
workspace back_and_forth
Toggle with previous workspace
workspace next / workspace prev
Cycle through used workspaces
workspace number <n>:<name>
Switch to a named workspace
move workspace to output <dir>
Send workspace to another monitor
workspace <ws> output <output>
Pin a workspace to a monitor (config)
assign [app_id="<name>"] workspace <ws>
Always open an app on a workspace (config)

Floating and Scratchpad

Mod+Shift+Space
Toggle floating
Mod+Left-drag
Move a floating window
Mod+Right-drag
Resize a floating window
Mod+Shift+-
Send window to scratchpad
Mod+-
Show / hide scratchpad window
for_window [app_id="<name>"] floating enable
Always float an app (config)
floating_modifier Mod normal
Mouse modifier for drags (config)

Resize

Mod+r
Enter resize mode
h / j / k / l
Shrink width / grow height / shrink height / grow width
Arrows do the same in the stock config.
Enter / Esc
Leave resize mode
resize set <w> <h>
Set an exact size

Session and Config

Mod+Enter
Open terminal
Mod+d
Open launcher
Mod+Shift+c
Reload config
Mod+Shift+e
Exit sway (asks first)
sway -C
Check the config for errors
swaymsg <command>
Run any sway command from a shell
swaymsg -t get_tree
Dump the window tree as JSON
Also get_outputs, get_inputs and get_workspaces.
swaymsg -t get_inputs
List input devices and their names
bindsym $mod+<key> <command>
Bind a key to a command (config)
bindsym --release <key> <command>
Fire on key release (config)
exec <command>
Start once at login (config)
exec_always <command>
Also run on every reload (config)
mode "<name>" { ... }
Define a binding mode (config)
set $mod Mod4
Use Super as the modifier (config)
output <name> resolution <w>x<h> position <x> <y>
Configure a monitor (config)
input type:keyboard xkb_layout <layout>
Set keyboard layout (config)

Recipes

Scratchpad terminal
# configbindsym $mod+Shift+minus move scratchpadbindsym $mod+minus scratchpad showfor_window [app_id="scratch"] move scratchpad# foot --app-id scratch &
Resize mode
mode "resize" {    bindsym l resize grow width 10px    bindsym Escape mode "default"}bindsym $mod+r mode "resize"
Pin apps to workspaces
assign [app_id="firefox"] workspace 2for_window [app_id="pavucontrol"] floating enable
Two monitors
swaymsg -t get_outputsoutput DP-1 position 0 0output HDMI-A-1 position 1920 0workspace 1 output DP-1