Sway

Sway (contracted from SirCmpwn's Wayland compositor) is Article description::an open-source that is designed to be compatible with the  window manager.

Configuration
To view all available configuration options:

Files
Each user running sway can edit the default configuration file in order to run a customized sway session. Gentoo stores this file at its default location:

Terminal emulator
By default the Sway configuration file uses the  (found in the  package). It is a good idea to emerge this terminal emulator so that a terminal will be available once Sway is running:

Other popular choices include or, which works natively with Wayland if the   environment variable is set to.

Another very lightweight alternative is, but it isn't Wayland native.

Display configuration
Display options can be queried with:

The results have been shortened to only contain the desired resolution. The default positions are not configured properly, and can be adjusted by modifying. Once the file is saved, the configuration can be reloaded with ++

Input Devices
Input devices can be queried with:

Application launcher
By default, Sway is configured to use dmenu, which uses X.  is a good alternative that supports Wayland.

Status bar
In addition to Sway's own status bar, can be used as a highly customizable status bar for Sway:

Brightness
can be used to adjust backlights and brightness. Here is an example config:

Alternatively, can also accomplish the same brightness changes via a  compatible command:

Sound volume
If is being used, the following configuration can be used for changing sound volume:

If is being used, the following configuration can be used for changing sound volume (with ):

If is being used, the following configuration can be used for changing the sound volume:

If is being used, the following configuration can be used for changing the sound volume:

Taking screenshots
To add screenshot support, use the utility (found in the  package). The abbreviation  is defined as Grab Images. This utility is tailored to the specifics of the Wayland protocol. In order to install grim, use the following command:

To add support for determining the boundaries of the selected screen area, the utility, found in the  package, is used in combination with the  utility. To install slurp, use the command:

Next, edit the configuration file to add support for keyboard shortcuts to perform a screenshot operation:

Please note that the or  +  keys combination creates a screenshot in the   buffer. This allows pasting the image directly from the clipboard, without having to save to a file on disk.

For the +  or  +  +  keyboard shortcuts, the method of automatically saving the image file in the  user directory is used.

Set a random wallpaper
A random wallpaper can be pulled from a folder and be set:

Swaylock
can be used to lock the current session.

Swayidle
runs a command after a certain idle time, typically to lock and/or power off the screen.

HiDPI
To adjust sway's rendering for HiDPI displays (4K and above), the name of the display to be adjusted must be obtained. After a sway session is running, issue the following:

The  statement in the sway configuration file will accept a   parameter to adjust the scaling of the high resolution display.

Executing sway
Some s may work but are not supported by sway. Without a display manager involved sway can be started from a tty:

Omitting the may cause.

Systems that are configured with neither systemd nor elogind will need to create a shell script (or use some other means) to set the XDG_RUNTIME_DIR variable.

The environment variable can be defined in the usual configuration files. For example, if sets the XDG_RUNTIME_DIR variable in his shell's configuration file and he has chosen that the directory will be in :

With the XDG_RUNTIME_DIR defined, sway can be launched as usual:

If issues are encountered, check Sway issues on GitHub before contacting the Sway community on IRC or opening a new Gentoo bug.

Launching Sway with TTY login
This is a simple method to start sway, this can be added to a user's shell rc file, and once logged in, a Sway session will execute.

Launching Sway from a script
This method uses a script to forcibly take over a virtual terminal and launch Sway in it. The typical use case is to launch Sway automatically on boot.

This script has a few limitations:


 * XDG_RUNTIME_DIR is expected to be defined and valid, see the section above.
 * Without the  option for openvt, sway will freeze when trying to switch to a different VT (++), whether this is a bug or not is unknown.
 * The VT is not cleared when Sway exits, clear it by calling deallocvt.
 * Similarly the TTY's owner and mode are not changed back to their default values when Sway exits.

Launching this script on boot can be done with the service:

Usage
All key combinations will be defined in the configuration file.

The key is defined as the   value by default. On most keyboards this will be the Windows key.

Movement
Sway has a -like interface. (left), (down),  (up), and  (right) can be used for movement.

See for more information.

Terminal
The default key combination to open a terminal emulator is +.

GTK theme and font
Currently setting a GTK font and theme should be done by editing sway's configuration file (see Sway's wiki as well):

If encountering problems setting the mouse cursor with certain applications (including sway), this may help:

Replace custom_cursor_theme and custom_cursor_size. Adwaita and 24 are pretty much default on all Linux distributions.

Screen sharing does not work
Make sure the package is installed. By default, it is autostarted by D-Bus but it fails to run because it needs environment variables exported by Sway, and the D-Bus session is started before Sway. To fix, update the D-Bus environment by adding the following line to the beginning of Sway's config:

Also see this link to see if is working properly. Note that, as of April 2022, screenshotting/screensharing is not yet implimented in wlroots/sway with the vulkan renderer (See this issue)

Failed to connect to user bus
[swaybar/tray/tray.c:42] Failed to connect to user bus: No such file or directory


 * Forum topic [swaybar/tray/tray.c:42 Failed to connect to user bus: No such file or directory] => Use
 * Forum topic sway(bar) with tray support
 * https://github.com/swaywm/sway/issues/1415

Warning: no icon themes loaded
[swaybar/tray/icon.c:348] Warning: no icon themes loaded

It is looking for

No backend was able to open a seat
[ERROR] [wlr] [libseat] [libseat/libseat.c:78] No backend was able to open a seat

It is looking for a seat management daemon such as or. Also check whether setting XDG_RUNTIME_DIR is required.

Applications forget logins
Some applications (e. g. ) use a Secret-Service-Agent to save credentials for login. If applications ask for account credentials every run, an incorrectly configured Secret-Service-Agent might be the reason.

First, emerge.

Then, enable the  USE flag.

Update the system to apply the new USE flag.

To run and unlock the Agent's storage when logging into a Sway session, edit these two files.

External resources

 * Arch linux sway wiki