Table of Contents

sway


#linux #config #dotfiles #desktop

sway is currently the most stable wayland compositor I have ever used. It's a drop-in replacement to i3.

Setup

Software

Here is the list of software I use with sway to run a functionning desktop:

Quick install

Here is an opinionated barebones list of basic programs you will need to run sway. For a full overview of tools and software I use, there is a list in the dotfiles entry of the wiki.

sudo pacman -S sway swayidle swaylock swaybg \
foot waybar fuzzel mako wlsunset wl-clipboard \

Sources

Troubleshooting

Common Issues with Screen Locking and Power Management

When configuring swayidle for automatic screen locking and display power management, certain syntax errors can prevent proper functionality.

Problematic Configuration

exec swayidle -w \
    timeout 600 'waylock -fork-on-lock'\       
    timeout 900 'swaymsg "output * power off"'\
    resume 'swaymsg "output * dpms on"'\
    before-sleep 'waylock'

Issues:

Corrected Configuration

exec swayidle -w \
    timeout 600 'waylock' \
    timeout 900 'swaymsg "output * power off"' \
    resume 'swaymsg "output * power on"' \
    before-sleep 'waylock'

Power vs DPMS Commands

Modern approach (recommended):

Legacy approach (still works):

Both achieve the same result, but power commands are preferred for new configurations as they use modern Wayland-native protocols and are more future-proof.

foot-server socket not starting after reboot (Sway)

Symptom: foot-server.socket is enabled but foot-server.service never starts after reboot. graphical-session.target remains inactive.

Root cause: foot-server.service depends on graphical-session.target, which can only be activated by a registered compositor service — not manually. Sway doesn't register itself with systemd by default.

Fix:

  1. Create a sway session target: ~/.config/systemd/user/sway-session.target

    [Unit]
    Description=Sway compositor session
    BindsTo=graphical-session.target
    Wants=graphical-session-pre.target
    After=graphical-session-pre.target
  2. Add to ~/.config/sway/config:

    exec systemctl --user import-environment WAYLAND_DISPLAY DISPLAY SWAYSOCK
    exec systemctl --user start sway-session.target
  3. Override foot-server's session dependency: ~/.config/systemd/user/foot-server.service.d/override.conf

    [Unit]
    PartOf=sway-session.target
    After=sway-session.target
  4. Reload and apply:

    systemctl --user daemon-reload
    systemctl --user start sway-session.target
↑ top