Sway

Sway (contracted from SirCmpwn's Wayland compositor) is Article description::an open-source [[Wayland compositor that is designed to be compatible with the i3 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 Alacritty terminal emulator (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:

Another popular choice is which works natively with Wayland if the   environment variable is set to.

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

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 pulseaudio is being used, the following configuration can be used for changing 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:

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
When using Systemd or Elogind Sway can be launched with:

Systems that are configured with neither systemd nor elogind will need to create a bash 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 XDG_RUNTIME_DIR variable in his Bash 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 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, you can do 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 local 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 Vi-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.