Installing Sway on Ubuntu for a cleaner desktop

Sway is a keyboard-driven tiling Wayland compositor for Linux. It arranges windows in non-overlapping tiles, responds quickly to commands and uses far fewer visual extras than a conventional desktop shell. On Ubuntu, it can replace the window-management layer without replacing the operating system, making it a practical way to try a different Linux workflow while keeping your files, accounts and applications unchanged.

Unlike GNOME’s stacked desktop, Sway divides the screen into workspaces and fills them with tiles. Every open program can be reached through the keyboard, while a mouse remains useful for menus and precise selection. It is especially handy on compact laptops, ageing office desktops and small mini-PCs where a polished but animation-heavy shell can feel wasteful.

This guide covers installation, a starter keyboard map, Waybar, Wofi, screens, locking and recovery. You can test the whole setup from a virtual terminal, so there is no need to alter the normal GNOME session on the first attempt. Have a go with the sample files, then change them to match your own habits and hardware.

Why Sway works well on Ubuntu

Sway is an i3-compatible window manager built on wlroots and Wayland. Instead of floating independent windows over a large background, it assigns each application a tile and keeps new windows out of the way. Workspaces, focus, movement and resizing all have key bindings, which makes the desktop predictable on a laptop as well as a multi-monitor desk.

Installing it does not require a new distribution or a clean installation. Ubuntu can keep GNOME as the default session while Sway is available as another login option. This matters in Australia, where the mainstream consumer market is dominated by Windows and macOS; a Sway setup is more likely to appear on a developer workstation, a community Linux machine in Melbourne or Sydney, or a recycled office mini-PC.

Because Sway has no large settings centre, preparation matters more than usual. Keep GNOME working, learn a few shortcuts before changing the display and know how to return to a text terminal. That safety net turns an unfamiliar window manager into a manageable experiment rather than an all-or-nothing change.

Install Sway without replacing GNOME

Open Terminal on Ubuntu, make sure the Universe repository is enabled, and install Sway with the supporting tools used in this guide:

sudo apt update
sudo apt install sway swaybg swaylock swayidle swaynag waybar wofi mako \
  alacritty grim slurp wl-clipboard wdisplays

The package names are available in Ubuntu 24.04 LTS and maintained desktop releases. Sway provides the compositor, Waybar supplies a status bar, Wofi launches applications and Mako displays notifications. Grim, Slurp and wl-clipboard support screenshots and clipboard actions. Foot is an optional alternative to Alacritty and can be added with sudo apt install foot.

Test Sway before adding it to the login screen. Press Ctrl+Alt+F3, sign in at the text prompt and run sway. If your session bus is not started, use dbus-run-session -- sway instead. A black screen can be escaped by returning to a virtual terminal with Ctrl+Alt+F3; use sway --unsupported-gpu only when the debug output confirms that GPU support is the problem.

Once the test succeeds, log out of Sway with swaymsg exit. If Ubuntu does not already list a Sway session, create ~/.local/share/wayland-sessions/sway.desktop with a small desktop entry:

[Desktop Entry]
Name=Sway
Comment=Wayland session with the Sway compositor
Exec=sway
Type=Application
DesktopNames=wayland

This gives you a visible option at the graphical login without removing or reconfiguring GNOME.

Create a practical first configuration

Sway reads its settings from ~/.config/sway/config. Create the directory, open the file in a text editor and begin with a compact configuration:

set $mod Mod4
set $term alacritty

exec-once = swaybg -c '#202020'
exec-once = mako
exec-once = waybar

bindsym $mod+Return exec $term
bindsym $mod+d exec wofi --show drun
bindsym $mod+Shift+e exec swaymsg exit
bindsym $mod+Shift+l exec swaylock --ignore-empty-input
bindsym $mod+Shift+c exec grim -g "$(slurp)" - | wl-copy
bindsym $mod+Shift+q kill

bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+Shift+1 move container to workspace number 1

bindsym $mod+Left focus left
bindsym $mod+Right focus right
bindsym $mod+Up focus up
bindsym $mod+Down focus down
bindsym $mod+Shift+Left move container to the left
bindsym $mod+Shift+Right move container to the right
bindsym $mod+Shift+Up move container to the up
bindsym $mod+Shift+Down move container to the down

input * {
    xkb_layout "us"
    repeat_delay 300
    repeat_rate 50
}

Mod4 is normally the Windows or Super key; $mod gives you one name to change later. GNOME-specific shortcuts such as Super+number may not act as expected, so the starter map includes a terminal, application launcher, workspace changes, focused-window movement, a screenshot and a lock command. swaymsg reload applies changes without ending the session.

The movement bindings act on the focused container, while the numbered bindings change or move workspaces. Add only a handful of shortcuts initially and write them beside the keyboard if needed. In Australian English, it is a sensible “give it a go” until every action has a stable location.

Add Waybar, Wofi and notifications

Waybar is controlled by files under ~/.config/waybar. This JSON configuration keeps workspaces on the left, a clock in the centre and useful system information on the right:

{
  "layer": "top",
  "position": "top",
  "modules-left": ["sway/workspaces", "sway/mode"],
  "modules-center": ["clock"],
  "modules-right": ["pulseaudio", "network", "cpu", "memory", "battery"],
  "clock": {
    "format": "{:%a %d %b %Y %H:%M}"
  }
}

The style file controls colours and spacing:

window {
  background: #202020;
  color: #e6e6e6;
}

#workspaces button {
  padding: 4px 8px;
}

#clock, #cpu, #memory, #network, #pulseaudio, #battery {
  padding: 4px 8px;
}

Wofi can also remember a default launcher view in ~/.config/wofi/config:

[wofi]
mode=drun
show=Applications

Binding $mod+d then opens Wofi in application mode. The launcher lists desktop entries from installed applications, so newly installed software appears without restarting Sway. Mako handles notifications, keeping desktop alerts visible without GNOME Shell.

Configure displays, input and Australian details

Run wdisplays to arrange monitors, choose a resolution and mirror or extend the screen. Sway treats each connected display as an output, so a laptop panel and an external office monitor can have different sizes and scales. If a window appears tiny, adjust the output scale rather than shrinking every application. For a wallpaper, replace the solid-colour swaybg command with swaybg -i /path/to/image -m fill.

Australian PC keyboards usually carry a standard US ANSI layout, so xkb_layout "us" is normally correct; Australian English is chosen within applications and does not require a separate keyboard layout. A few users prefer another variant or a Mac layout, in which case change xkb_layout and xkb_variant together. If the laptop lacks a usable Super key, map $mod to Mod1 for Alt instead.

Local time is handled by the system clock. Brisbane stays on AEST, Perth uses AWST, Sydney and Melbourne move to AEDT, Adelaide uses ACDT during daylight saving and Hobart follows the eastern pattern. A 24-hour clock and day-first dates suit Australian conventions; the Waybar format can show that style without affecting the rest of the system.

The NBN and fixed-wireless market has little bearing on compositor performance because Sway renders locally. A slow interstate or regional connection can make remote control feel laggy, but it will not make window movement stutter. This makes Sway a good fit for a small home server or thin client in regional Australia as long as the display and graphics hardware are suitable.

Keep the desktop secure and easy to recover

Swayidle can launch the lock screen after a period of inactivity. Create ~/.config/sway/idle with:

idle-time 300
exec swaylock --ignore-empty-input

Change 300 to the number of seconds that suits your routine. The manual lock binding already included in the main configuration works immediately. Keep a separate session running on another virtual terminal if you are testing unfamiliar settings, and remember that Ctrl+Alt+F2 or Ctrl+Alt+F3 can take you back to a login prompt without relying on the graphical session.

If Sway fails to start, inspect the error from the virtual terminal and run sway --debug for more detail. swaymsg reload is useful for spotting configuration mistakes after editing. For NVIDIA cards, install the recommended proprietary driver through Ubuntu’s driver tool and complete any Secure Boot confirmation; avoid unrelated driver packages or random PPAs. Intel and AMD systems normally use Ubuntu’s Mesa packages and need no extra step.

Most desktop applications run through XWayland automatically, while native Wayland versions are preferred where available. Screen sharing can require xdg-desktop-portal-wlr to be installed and selected by the desktop portal configuration. Some Electron applications may need their Wayland flag enabled. Keep files outside temporary compositor directories, back up ~/.config/sway and remember that Ubuntu’s own upgrades do not replace this personal configuration.

Sway changes how the desktop feels, not where your data lives. GNOME remains available as a fallback, the configuration is confined to your home directory and the same tiling layout can adapt from a laptop in Adelaide to a dual-monitor desk in Canberra.

Remember that the durable Sway setup is the one you understand: its key bindings, displays, status bar, notifications and lock screen all live in clear configuration files, while Ubuntu continues to provide the operating system beneath it.