I have been using the i3 tiling window manager under manjaro on my Lenovo Thinkpad laptop for years, but with the replacement of X11 by wayland, I became interested in a solution compatible with this new display protocol, Sway.
As I started to use it, I felt the need to summarise my findings here, especially the hotkeys, which are key to keeping your hands on the keyboard at all times.
General Keybindings
Description | Keybinding |
---|---|
Change window focus | Mod + arrow keys |
Vim keys are supported | Mod + H J K L |
Close a window | Mod + Backspace |
Move a window | Mod + Shift + arrow keys |
Move window with mouse | Mod + left click |
Resize a window | Mod + R, resize with arrow keys, Esc |
Resize with right click | Mod + right click |
Change workspace | Mod + 1, 2, 3, … |
Send window to workspace | Mod + Shift + 1, 2, 3, … |
Toggle floating/tiling | Mod + Space |
Toggle fullscreen | Mod + F |
Grow text | Ctrl + Shit + + |
Reload Sway configuration | Mod + Shift + C |
Quit program | Mod + Shift + Q |
Application Shortcuts
Description | Keybinding |
---|---|
Launch the terminal | Mod + Enter |
Launch the file explorer | Mod + E |
Launch the web browser | Mod + B |
Launch the text editor | Mod + T |
Launch the calculator | Mod + C |
Launchers and Menus
Description | Keybinding |
---|---|
Open the launcher | Mod + D |
Open the application menu | Mod + Shift + D |
Open the power menu | Ctrl + Alt + Delete |
Switch back to previous window | Alt + Tab |
Activities overview | Mod + Tab |
Workspace overview | Mod + Shift + Tab |
Scratchpad
Description | Keybinding |
---|---|
Move window to scratchpad | Mod + Shift + - |
Show next scratchpad window | Mod + - |
Screenshots
Description | Keybinding |
---|---|
Snip a screenshot | Print |
Screenshot a window | Ctrl + Print |
Screenshot the display | Shift + Print |
Clipboard Manager
Description | Keybinding |
---|---|
Launch cliphist | Ctrl + Mod + V |
Delete an entry from cliphist | Ctrl + Mod + X |
Other bindings
Description | Keybinding |
---|---|
Shortcut to Sway config | Mod + Shift + I |
Arch Linux installation
pacman -S sway swaylock swayidle swaybg alacritty xorg-xwayland wtype
pacman -S wmenu foot # application launcher & terminal dependencies
pacman -S wayvnc # VNC server for sway
seatd
is required for Wayland to give sway access to keyboard/mouse/..
systemctl start seatd
gpasswd -a <user> seat
gpasswd -a <user> video
gpasswd -a <user> input
Sway configuration
Copy the Sway default configuration to your config directory
cp /etc/sway/config ~/.config/sway/config
You can also reuse instead your i3 configuration file which is compatible with sway.
The default Mod key is the Meta/Super key.
- On a Windows keyboard, this will be the “Windows” key.
- On an Apple keyboard, this will be the “Cmd” key.
If you wish, you can change the Mod key to something else in your Sway config. In particular change the Mod
key which should be Mod4
if you access Sway from MacOS thru a VNC client like I’m doing.
vi ~/.config/sway/config
set $mod Mod1
Now grab the name of your display with
swaymsg -t get_outputs
You can now edit your display configuration for example
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
output HEADLESS-1 resolution 1920x1200 position 0,0
End the installation and configuration by reloading your configuration with Mod + Shift + C
You can easily remotely access using a VNC client by running the integrated server wayvnc <IP> 5901
and create a SSH tunnel from your client machine
ssh -L 5901:localhost:5901 <user>@<sway_srv_ip>
Conclusion
Once you start using a tiling window manager, after a while you become so productive that you don’t want to go back to a traditional one. Even people on MacOS are starting to use tiling window managers like Aerospace, Amethyst or yabai.
Links
- Sway Official website
- Sway Wiki
- Sway cheatsheet inspired by the i3 reference card.
- i3 migration guide