Convert Figma logo to code with AI

swaywm logosway

i3-compatible Wayland compositor

14,396
1,097
14,396
1,056

Top Related Projects

9,405

A tiling window manager for X11

19,564

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.

7,707

A tiling window manager based on binary space partitioning

4,070

A lightweight compositor for X11 with animation support

A manual tiling window manager for X11

6,319

awesome window manager

Quick Overview

Sway is an open-source tiling Wayland compositor and a drop-in replacement for the i3 window manager for X11. It aims to provide a modern, efficient, and customizable desktop environment for Linux users, with a focus on keyboard-driven workflows and minimal resource usage.

Pros

  • Seamless transition for i3 users, as it maintains compatibility with i3 configuration files
  • Native Wayland support, offering better performance and security compared to X11
  • Highly customizable and extensible through a simple configuration language
  • Lightweight and resource-efficient, suitable for both powerful and low-end hardware

Cons

  • Limited support for some X11-specific applications and features
  • Steeper learning curve for users not familiar with tiling window managers
  • Potential compatibility issues with certain hardware or graphics drivers
  • Smaller ecosystem of third-party tools and extensions compared to more mainstream desktop environments

Getting Started

To install Sway on a Linux system, follow these steps:

  1. Install Sway and its dependencies:

    # For Ubuntu/Debian:
    sudo apt install sway
    
    # For Arch Linux:
    sudo pacman -S sway
    
  2. Create a basic configuration file:

    mkdir -p ~/.config/sway
    cp /etc/sway/config ~/.config/sway/config
    
  3. Start Sway:

    exec sway
    

For more detailed configuration and usage instructions, refer to the official Sway documentation at https://github.com/swaywm/sway/wiki.

Competitor Comparisons

9,405

A tiling window manager for X11

Pros of i3

  • Mature and stable project with a large user base
  • Extensive documentation and community support
  • Works with X11, which is still widely used

Cons of i3

  • Limited to X11, not compatible with Wayland
  • Less modern features compared to newer window managers
  • Slower development pace due to established codebase

Code Comparison

i3 (C):

static void handle_expose_event(xcb_expose_event_t *event) {
    struct Con *con;
    if ((con = con_by_window_id(event->window)) == NULL)
        return;
    x_push_changes(con);
}

Sway (C):

static void handle_layer_surface_commit(struct wlr_surface *surface) {
    struct sway_layer_surface *layer = layer_from_wlr_layer_surface(surface->data);
    if (!layer) {
        return;
    }
    arrange_layers(layer->output);
}

Key Differences

  • Sway is built for Wayland, while i3 is for X11
  • Sway aims to be a drop-in replacement for i3 on Wayland
  • Sway includes more modern features and active development
  • i3 has a larger existing user base and ecosystem

Both projects are tiling window managers written in C, but Sway is designed for the newer Wayland display protocol, offering improved security and performance. i3 remains popular due to its stability and widespread X11 usage.

19,564

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.

Pros of Hyprland

  • More customizable and feature-rich, offering advanced animations and effects
  • Better performance on high-refresh-rate displays
  • Supports both X11 and Wayland protocols

Cons of Hyprland

  • Less stable and mature compared to Sway
  • Steeper learning curve due to more complex configuration options
  • Smaller community and ecosystem

Code Comparison

Hyprland configuration example:

monitor=,preferred,auto,1

input {
    kb_layout = us
    follow_mouse = 1
}

general {
    gaps_in = 5
    gaps_out = 20
    border_size = 2
    col.active_border = rgba(33ccffee)
}

Sway configuration example:

output * bg ~/Pictures/wallpaper.png fill

input "type:keyboard" {
    xkb_layout us
}

gaps inner 5
gaps outer 20
default_border pixel 2
client.focused #33ccff #33ccff #ffffff

Both Hyprland and Sway use similar configuration syntax, but Hyprland offers more advanced options for customization and visual effects. Sway's configuration is generally simpler and more straightforward, reflecting its focus on stability and compatibility with i3 configurations.

7,707

A tiling window manager based on binary space partitioning

Pros of bspwm

  • Lightweight and minimal resource usage
  • Highly customizable through simple shell scripts
  • Works well with external bars and utilities

Cons of bspwm

  • X11-only, no Wayland support
  • Less user-friendly for beginners
  • Requires more manual configuration

Code Comparison

bspwm configuration (bspwmrc):

#! /bin/sh

bspc monitor -d I II III IV V VI VII VIII IX X
bspc config border_width         2
bspc config window_gap          12
bspc config split_ratio          0.52

Sway configuration (config):

# Default config for sway
# Read `man 5 sway` for a complete reference.

### Output configuration
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill

bspwm is a tiling window manager for X11, focusing on simplicity and extensibility. It uses a binary space partitioning layout algorithm and is controlled through shell commands. Sway, on the other hand, is a Wayland compositor designed as a drop-in replacement for i3, offering modern features and Wayland compatibility.

While bspwm excels in minimalism and customization, Sway provides a more user-friendly experience with built-in features like a status bar and better multi-monitor support. The choice between them often depends on whether Wayland support is needed and the user's preference for configuration complexity versus out-of-the-box functionality.

4,070

A lightweight compositor for X11 with animation support

Pros of picom

  • Lightweight and focused on compositing, making it more versatile for use with various window managers
  • Offers extensive configuration options for visual effects and performance tuning
  • Actively maintained with frequent updates and bug fixes

Cons of picom

  • Limited to X11 environments, not compatible with Wayland
  • Requires separate window manager, increasing system complexity
  • May introduce screen tearing or performance issues on some hardware configurations

Code comparison

picom (configuration example):

backend = "glx";
vsync = true;
shadow = true;
fading = true;
inactive-opacity = 0.8;

Sway (configuration example):

output * bg ~/wallpaper.png fill
input * {
    xkb_layout "us"
}
bar {
    position top
}

Key differences

  • Sway is a complete Wayland compositor and window manager, while picom is an X11 compositor only
  • Sway uses wlroots as its backend, offering better Wayland integration and performance
  • picom focuses on visual effects and customization, while Sway prioritizes functionality and Wayland compatibility
  • Sway's configuration is more similar to i3, making it familiar for i3 users transitioning to Wayland

A manual tiling window manager for X11

Pros of herbstluftwm

  • Highly customizable through a simple scripting interface
  • Lightweight and minimal resource usage
  • Supports multiple monitors with independent workspaces

Cons of herbstluftwm

  • X11-based, lacking Wayland support
  • Steeper learning curve for configuration
  • Less active development compared to Sway

Code Comparison

herbstluftwm configuration example:

hc keybind $Mod-Shift-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-w close
hc keybind $Mod-Return spawn ${TERMINAL:-xterm}

Sway configuration example:

bindsym $mod+Shift+q exit
bindsym $mod+Shift+c reload
bindsym $mod+q kill
bindsym $mod+Return exec $term

Both window managers use similar configuration syntax, but herbstluftwm uses a separate script for configuration, while Sway uses a configuration file similar to i3. Sway's configuration is generally more straightforward and familiar to i3 users, while herbstluftwm offers more flexibility through its scripting approach.

6,319

awesome window manager

Pros of awesome

  • Highly customizable using Lua scripting
  • Extensive widget system for creating complex layouts
  • Supports multiple monitors out of the box

Cons of awesome

  • X11-based, lacking Wayland support
  • Steeper learning curve due to Lua configuration
  • Less modern default appearance

Code comparison

awesome (rc.lua):

awful.layout.layouts = {
    awful.layout.suit.floating,
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
}

Sway (config):

output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
input * {
    xkb_layout "us"
    xkb_variant "colemak"
}

awesome focuses on providing a highly customizable environment through Lua scripting, offering extensive widget support and multi-monitor capabilities. However, it lacks Wayland support and has a steeper learning curve.

Sway, being Wayland-based, offers better compatibility with modern systems and a simpler configuration syntax. It provides a more streamlined experience out of the box but may have fewer customization options compared to awesome's Lua-based approach.

The code examples highlight the difference in configuration styles, with awesome using Lua for layout definitions and Sway using a more straightforward key-value syntax for basic settings.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

sway

English - عربي - Česky - Deutsch - Dansk - Español - Français - ქართული - Ελληνικά - हिन्दी - Magyar - فارسی - Italiano - 日本語 - 한국어 - Nederlands - Norsk - Polski - Português - Română - Русский - Svenska - Türkçe - Українська - 中文-简体 - 中文-繁體

sway is an i3-compatible Wayland compositor. Read the FAQ. Join the IRC channel (#sway on irc.libera.chat).

Release Signatures

Releases are signed with E88F5E48 and published on GitHub.

Installation

From Packages

Sway is available in many distributions. Try installing the "sway" package for yours.

Compiling from Source

Check out this wiki page if you want to build the HEAD of sway and wlroots for testing or development.

Install dependencies:

  • meson *
  • wlroots
  • wayland
  • wayland-protocols *
  • pcre2
  • json-c
  • pango
  • cairo
  • gdk-pixbuf2 (optional: additional image formats for system tray)
  • swaybg (optional: wallpaper)
  • scdoc (optional: man pages) *
  • git (optional: version info) *

* Compile-time dep

Run these commands:

meson build/
ninja -C build/
sudo ninja -C build/ install

Configuration

If you already use i3, then copy your i3 config to ~/.config/sway/config and it'll work out of the box. Otherwise, copy the sample configuration file to ~/.config/sway/config. It is usually located at /etc/sway/config. Run man 5 sway for information on the configuration.

Running

Run sway from a TTY. Some display managers may work but are not supported by sway (gdm is known to work fairly well).