How to Install & Use Sway Window Manager on Linux (Step-by-Step)

sway-window-manager-config-file
Reading Time: 5 minutes

Introduction

Sway Window Manager is a powerful, lightweight tiling window manager built for Wayland. It’s designed as a drop-in replacement for i3, offering familiar keyboard-driven workflow with modern display protocol support. Whether you’re new to tiling WMs or looking for a cleaner, more performant setup, Sway is a flexible and extensible solution. In this tutorial, you’ll learn how to install Sway, configure it, and run it in a virtual machine so you can experiment risk-free before committing to your setup.

If you’re new to the concept of window managers, I recommend starting with my post, What is a Window Manager? A Beginner’s Guide to Linux WMs, to understand the basics before diving into Sway.

Wayland is a modern display server protocol, and Sway fully embraces it. To understand how Wayland compares to X11, see my post on Exploring X11, Wayland, and GNOME vs KDE.


What is Sway?

Sway is a tiling window manager that works exclusively with Wayland, a newer display protocol designed to replace X11. It’s built to be a drop-in replacement for i3, meaning you can use many i3 configurations directly with Sway. With its active development and strong community, Sway is ideal for users who value speed, simplicity, and customization.

Sway is just one of many excellent window managers available today. If you’re interested in exploring other options, including X11 and Wayland-based managers, check out my Comprehensive Guide to Window Managers.

Key Features of Sway:

  • Full compatibility with i3 configs.
  • Native Wayland support for improved performance and security.
  • Lightweight and efficient for older hardware or minimal systems.
  • Extensive customization via a single configuration file.

Sway Window Manager Tutorial: Setup in a Virtual Machine

Step 1: Create Your Sway Linux VM Environment

To try Sway without affecting your main system, use a virtual machine. Here’s how to do it:

  1. Download an ISO with Sway Preinstalled:
    • Recommended distros:
      • Fedora (with Sway Spin).
      • Arch Linux (minimal base with manual Sway installation).
    • Alternatively, use a minimal ISO and install Sway manually.
  2. Install Your VM:
    • Use virtualization software like VirtualBox, VMware, or QEMU/KVM.
    • Allocate resources:
      • 2GB+ RAM.
      • 2 CPU cores.
      • 20GB disk space.
  3. Boot into Sway:
    • Start your VM and log in.
    • If Sway is installed but not started, run sway from a terminal.

Step 2: Accessing Project Resources

Before diving into configuration, familiarize yourself with Sway’s official resources:

Make sure to read the documentation through, especially if you are new to window managers and editing config file, I usually keep the documentation open when I am working on my VM, so I can reference it.


First Login: Understanding Sway’s Basics

my-sway-window-manager-desktop-environment

When you first log into Sway, you’ll be greeted by a minimal and efficient workspace, mine here has been edited, but it will be very similar. This can feel a bit stark compared to traditional desktop environments, but it’s designed to give you total control and flexibility. Here’s what to expect and how to get started:


What You’ll See

  • A blank, minimal desktop: There are no taskbars, desktop icons, or wallpapers by default.
  • Keyboard-driven navigation: Sway relies heavily on keyboard shortcuts for window management and navigation.
  • Waybar (if installed): If you’ve installed Waybar, you’ll notice a small, customizable taskbar at the top or bottom. It shows system stats like CPU usage, RAM, and network activity.

What to Do First

  1. Open a Terminal:
    • Press Mod+Enter (where Mod is typically the Super/Windows key) to open a terminal.
    • From here, you can launch applications, edit configuration files, or install additional tools.
  2. Explore the Default Keybindings:
    Familiarizing yourself with the keybindings is critical for navigating and using Sway effectively.
    • Mod+Q → Closes the currently focused window.
    • Mod+Shift+E → Exits Sway gracefully.
    Resource: Visit the Official Sway Keybindings Documentation to learn more.
  3. Understand the Tiling Layout:
    • By default, windows are automatically tiled, making efficient use of your screen space.
    • Use the Mod key with arrow keys or shortcuts to adjust the layout and move between windows.

First Steps After Logging In

Here’s a checklist to get started:

  • Edit the Configuration File:
    Sway’s behavior is controlled by its configuration file, usually located at ~/.config/sway/config. Open it with your preferred text editor: vim ~/.config/sway/config Modify keybindings, default applications, and other settings to match your preferences.
  • Set a Wallpaper:
    Install a wallpaper tool like swaybg or feh to personalize your desktop. For example, you can run: swaybg -i /path/to/your/wallpaper.jpg
  • Test Applications:
    Launch common Wayland-compatible applications (e.g., foot, alacritty, or firefox) to ensure your setup is functional.
sway-window-manager-config-file

What to Do if You Feel Overwhelmed

  • Start Small: Focus on understanding a few basic keybindings like opening/closing terminals and switching windows.
  • Use Resources: The Sway Wiki and Arch Wiki are invaluable for troubleshooting and advanced setup.
  • Find Inspiration: Browse r/unixporn for inspiration and ideas on how to customize your setup.

By taking it one step at a time, you’ll quickly gain confidence in using Sway and appreciate the freedom it offers.


Finding Your Style

Customize Sway to suit your workflow:

  • Minimalist Setup: Focus on keyboard shortcuts and remove distractions.
  • Feature-Rich Setup: Add bars, launchers (like Rofi), and graphical apps.

Examples of Configs:


Wrapping Up + More Linux Tips

Sway offers unparalleled freedom to craft a desktop environment tailored to your workflow. With its lightweight tiling layout and Wayland compatibility, it’s an ideal choice for power users, minimalists, and Linux enthusiasts seeking speed and control.

If you’re exploring Linux further, you might also like:

Have questions or want to share your Sway setup? Drop a comment or reach out — I’d love to help you customize and optimize your environment.

Frequently Asked Questions

What is the difference between i3 and Sway?

Sway is a Wayland-compatible tiling window manager that mirrors the i3 user experience, but it supports modern display protocols and hardware better than i3.

How do I install Sway Window Manager?

You can install Sway on most Linux distributions using your package manager. For example, on Arch: sudo pacman -S sway.

Is Sway good for beginners?

Yes. While it has a learning curve, this guide walks you through installing and customizing it step-by-step, making it approachable for new users.

Does Sway support all i3 features?

Sway aims for compatibility with i3’s config and keybindings, but it also supports additional Wayland-native features i3 does not.

Can I run Sway in a virtual machine?

Yes. This tutorial explains how to set up Sway in a VM so you can test your configuration safely before deploying to hardware.