Differences between revisions 2 and 8 (spanning 6 versions)
Revision 2 as of 2020-05-19 02:35:37
Size: 2861
Comment: Basic reformatting and copyediting, add information about official support in Debian 11
Revision 8 as of 2023-04-15 14:46:20
Size: 5464
Editor: ?Astindev
Comment: Update DebianMan
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The Sway Window Manager ([[https://swaywm.org/|official site]]), is a tiling Wayland compositor and a drop-in replacement for the [[https://wiki.debian.org/i3|i3 window manager]] for X11. It works with your existing i3 configuration and supports most of i3's features, plus a few extras. The [[https://swaywm.org/|Sway Window Manager]] is a tiling Wayland compositor and a drop-in replacement for the [[i3|i3 window manager]] for X11. It works with your existing i3 configuration and supports most of i3's features, plus a few extras.
Line 11: Line 11:
== Installation from unstable and experimental == == Installation ==
Line 14: Line 14:
Line 17: Line 18:
Line 19: Line 21:
 * DebPkg:sway-backgrounds - This package contains a set of desktop backgrounds that come with Sway.
 * DebPkg:swaybg - Sway's wallpaper utility for Wayland compositors.
 * DebPkg:swayidle - Sway's idle management daemon. {{{swayidle}}} listens for idle activity on your Wayland compositor and executes tasks on various idle-related events.
 * DebPkg:swaylock - Sway's screenlocking utility for Wayland.
 * DebianPkg:sway-backgrounds - This package contains a set of desktop backgrounds that come with Sway.
 * DebianPkg:swaybg - Sway's wallpaper utility for Wayland compositors.
 * DebianPkg:swayidle - Sway's idle management daemon. {{{swayidle}}} listens for idle activity on your Wayland compositor and executes tasks on various idle-related events.
 * DebianPkg:swaylock - Sway's screenlocking utility for Wayland.
 * DebianPkg:xdg-desktop-portal-wlr - Support for the screenshot, screencast, and possibly remote-desktop.
 * DebianPkg:xwayland - Support for Xwayland apps
Line 31: Line 35:
Line 41: Line 46:
Line 46: Line 52:
Line 53: Line 60:
Line 54: Line 62:
Line 61: Line 70:

To begin configuring sway, copy the sample configuration file located at /etc/sway/config to ~/.config/sway/config.
{{{
$ mkdir -p ~/.config/sway
$ cp /etc/sway/config ~/.config/sway/
$ nano ~/.config/sway/config
}}}

==== Display configuration ====

To organize your screens, start by running the command '''swaymsg -t get_outputs''' to get a list of output names.

Then, use the 'output' command in sway's config file with the desired output identifier to configure display options, as shown in the example below:
{{{
output <identifier> {
    # ...config options...
    mode 2560x1080@74.991Hz
    pos 0,0
}
# laptop display example
output eDP-1 {
    mode 1366x768
    position 2560,0
}
}}}
Make sure to check the ''available modes'' for each monitor using the output list obtained earlier.

For detailed information, check DebianMan:sway-output manual.

==== Brightness ====

You can use DebianPkg:brightnessctl or DebianPkg:light to control the brightness

Example with light
{{{
bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5
}}}
Example with brightnessctl
{{{
bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
}}}

Line 65: Line 119:
== Troubleshooting ==

=== Running programs natively under Wayland ===

There are several ways to configure the necessary environment variables to run your apps natively, without Xwayland. Depending on your preferences and setup, you can choose one of the following alternatives: add the variables to your launcher script, export them in your '''~/.bashrc''' file, place them in the '''/etc/environment''' file, or include them in a session file if you're using a display manager.

==== GTK3 ====
Wayland will be selected by default. Do not set GDK_BACKEND, it will break apps (e.g. Chromium and Electron).

'''DebianWiki:Firefox:''' Experimental Wayland support in Firefox can be enabled with {{{MOZ_ENABLE_WAYLAND=1}}}

'''DebianWiki:LibreOffice:''' If Wayland wasn't used by default, try enabling it with {{{SAL_USE_VCLPLUGIN=gtk3}}}
==== Qt5 ====
To enable Wayland support, you might need DebianPkg:qtwayland5 package.

When using a display manager, Wayland is used by default if {{{XDG_SESSION_TYPE=wayland}}} is set. If you're not using a display manager, set {{{QT_QPA_PLATFORM=wayland-egl}}}.

=== Issues with Java applications ===
Try to set {{{_JAVA_AWT_WM_NONREPARENTING=1}}}

Line 66: Line 141:
Line 78: Line 154:
[[DebianMan:sway|Manpages]] [[DebianMan:sway|Manual page]]

What is Sway?

The Sway Window Manager is a tiling Wayland compositor and a drop-in replacement for the i3 window manager for X11. It works with your existing i3 configuration and supports most of i3's features, plus a few extras.

Sway is not available as an option in the Debian Installer but can be added post-installation in Debian 11/Bullseye and newer.

Sway does not support the proprietary NVIDIA drivers in any form.

Installation

Installing Sway from the repos in Debian 11 and newer is often as easy as typing:

# apt install sway

This brings in a minimal installation. Additional packages are also available, such as:

  • sway-backgrounds - This package contains a set of desktop backgrounds that come with Sway.

  • swaybg - Sway's wallpaper utility for Wayland compositors.

  • swayidle - Sway's idle management daemon. swayidle listens for idle activity on your Wayland compositor and executes tasks on various idle-related events.

  • swaylock - Sway's screenlocking utility for Wayland.

  • xdg-desktop-portal-wlr - Support for the screenshot, screencast, and possibly remote-desktop.

  • xwayland - Support for Xwayland apps

At this step, do not start your session on Sway as you will most likely be stuck. Configure it first.


Configuration

From i3

If you're coming from i3, it's best to read the brief official i3 migration guide.

To migrate existing i3 files:

$ mkdir ~/.config/sway 
$ cp ~/.config/i3/config ~/.config/sway/config
$ cat ~.Xresources >> ~/.Xdefaults

You also need to have your keyboard layout information. This can help:

$ swaymsg -t get_inputs

Add something like this in your ~/.config/sway/config file:

 input * xkb_layout "us,de,ru"
 input * xkb_variant "colemak,,typewriter"
 input * xkb_options "grp:win_space_toggle"
 input "MANUFACTURER1 Keyboard" xkb_model "pc101"
 input "MANUFACTURER2 Keyboard" xkb_model "jp106"

You probably also want this in your Sway configuration file:

include /etc/sway/config.d/*

When it’s done, you can disconnect yourself from your i3 session and log back to Sway.

From scratch

To begin configuring sway, copy the sample configuration file located at /etc/sway/config to ~/.config/sway/config.

$ mkdir -p ~/.config/sway
$ cp /etc/sway/config ~/.config/sway/
$ nano ~/.config/sway/config

Display configuration

To organize your screens, start by running the command swaymsg -t get_outputs to get a list of output names.

Then, use the 'output' command in sway's config file with the desired output identifier to configure display options, as shown in the example below:

output <identifier> {
    # ...config options...
    mode 2560x1080@74.991Hz
    pos 0,0
}
# laptop display example
output eDP-1 {
    mode 1366x768
    position 2560,0
}

Make sure to check the available modes for each monitor using the output list obtained earlier.

For detailed information, check sway-output manual.

Brightness

You can use brightnessctl or light to control the brightness

Example with light

bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5

Example with brightnessctl

bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-

The best reference for configuring Sway from scratch can be found on their official wiki: https://github.com/swaywm/sway/wiki


Troubleshooting

Running programs natively under Wayland

There are several ways to configure the necessary environment variables to run your apps natively, without Xwayland. Depending on your preferences and setup, you can choose one of the following alternatives: add the variables to your launcher script, export them in your ~/.bashrc file, place them in the /etc/environment file, or include them in a session file if you're using a display manager.

GTK3

Wayland will be selected by default. Do not set GDK_BACKEND, it will break apps (e.g. Chromium and Electron).

Firefox: Experimental Wayland support in Firefox can be enabled with MOZ_ENABLE_WAYLAND=1

LibreOffice: If Wayland wasn't used by default, try enabling it with SAL_USE_VCLPLUGIN=gtk3

Qt5

To enable Wayland support, you might need qtwayland5 package.

When using a display manager, Wayland is used by default if XDG_SESSION_TYPE=wayland is set. If you're not using a display manager, set QT_QPA_PLATFORM=wayland-egl.

Issues with Java applications

Try to set _JAVA_AWT_WM_NONREPARENTING=1

See also

Official Sway homepage

Official Sway wiki (Github)

Sway on Wikipedia

Debian-specific information

Bugs

Package tracker

Manual page

Security tracker