Sway: Difference between revisions
Prabuanand (talk | contribs) (refactored page related to greetd, removed quickstart reference) |
Prabuanand (talk | contribs) (Changed the heading levels, reorganized content, added video error message) |
||
Line 5: | Line 5: | ||
The above command installs {{pkg|wayland-base|repo=main}} which includes {{pkg|elogind|repo=main}}, {{pkg|polkit-elogind|repo=main}}, {{pkg|eudev|repo=main}} and the following packages {{pkg|dmenu|repo=main}}, {{pkg|font-dejavu |repo=main}}, {{pkg|foot|repo=main}}, {{pkg|grim|repo=main}}, {{pkg|i3status|repo=main}}, {{pkg|sway|repo=main}}, {{pkg|swayidle|repo=main}}, {{pkg|swaylockd|repo=main}}, {{pkg|util-linux-login|repo=main}}, {{pkg|wl-clipboard|repo=main}}, {{pkg|wmenu|repo=main}}, {{pkg|xwayland|repo=main}} | The above command installs {{pkg|wayland-base|repo=main}} which includes {{pkg|elogind|repo=main}}, {{pkg|polkit-elogind|repo=main}}, {{pkg|eudev|repo=main}} and the following packages {{pkg|dmenu|repo=main}}, {{pkg|font-dejavu |repo=main}}, {{pkg|foot|repo=main}}, {{pkg|grim|repo=main}}, {{pkg|i3status|repo=main}}, {{pkg|sway|repo=main}}, {{pkg|swayidle|repo=main}}, {{pkg|swaylockd|repo=main}}, {{pkg|util-linux-login|repo=main}}, {{pkg|wl-clipboard|repo=main}}, {{pkg|wmenu|repo=main}}, {{pkg|xwayland|repo=main}} | ||
{{Note| [[#Installation using setup-desktop|Setup-desktop]] for sway does not install drivers for [[#Install Graphics Drivers|video]] , [[#PipeWire_and_Screensharing|audio]] and greeters like [[greetd]]}} | {{Note| [[#Installation using setup-desktop|Setup-desktop]] for sway does not install drivers for [[#Install Graphics Drivers|video]] , [[#PipeWire_and_Screensharing|audio]] and greeters like [[greetd]].}} | ||
Since the above utility pulls in all the necessary dependencies except [[#Install Graphics Drivers|video]] | Since the above utility pulls in all the necessary dependencies except [[#Install Graphics Drivers|video]] and starts necessary services, you can launch sway by issuing the command <code>sway</code> from TTY. | ||
{{cmd|$ sway}} | {{cmd|$ sway}} | ||
Line 27: | Line 27: | ||
=== Install Graphics Drivers === | === Install Graphics Drivers === | ||
{{:Graphics_driver}} | {{:Graphics_driver}} | ||
=== Setting up a seat manager === | === Setting up a seat manager === | ||
Line 40: | Line 39: | ||
See [[Elogind]]. | See [[Elogind]]. | ||
=== Install greetd (optional) === | === Install greetd (optional) === | ||
Line 78: | Line 52: | ||
=== Install Sway === | === Install Sway === | ||
{{cmd|# apk add sway \ | |||
xwayland \ # if you need xserver | xwayland \ # if you need xserver | ||
foot \ # default terminal emulator. Modify $term in config for a different one. | foot \ # default terminal emulator. Modify $term in config for a different one. | ||
Line 88: | Line 62: | ||
i3status \ # simple status bar | i3status \ # simple status bar | ||
swayidle # idle management (DPMS) daemon | swayidle # idle management (DPMS) daemon | ||
}} | |||
For complimentary software alternatives, see [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the relevant page from sway's wiki] or [https://wiki.gentoo.org/wiki/List_of_software_for_Wayland this list at Gentoo Wiki.] | For complimentary software alternatives, see [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the relevant page from sway's wiki] or [https://wiki.gentoo.org/wiki/List_of_software_for_Wayland this list at Gentoo Wiki.] | ||
= Configuration = | == Configuration == | ||
Copy default sway configuration to <code>~/.config</code>: | Copy default sway configuration to <code>~/.config</code>: | ||
{{cmd|$ mkdir -p ~/.config/sway | |||
$ cp /etc/sway/config ~/.config/sway/}} | |||
Read through it to learn the default keybindings. | Read through it to learn the default keybindings. | ||
Sway configuration is mostly backwards-compatible with that of [[I3wm|i3]] and if you are looking for a solution for a specific issue, you may also try checking if it hasn't been provided for i3WM. | Sway configuration is mostly backwards-compatible with that of [[I3wm|i3]] and if you are looking for a solution for a specific issue, you may also try checking if it hasn't been provided for i3WM. | ||
Line 108: | Line 79: | ||
One can launch sway by issuing the command sway from TTY. | One can launch sway by issuing the command sway from TTY. | ||
{{Cmd|sway}} | {{Cmd|$ sway}} | ||
You can also sway with a greeter like [[greetd]]. In this case, to start sway session for the user, you might want to start a [[D-Bus#D-Bus_session|D-Bus session]] when the greetd session is started. | You can also sway with a greeter like [[greetd]]. In this case, to start sway session for the user, you might want to start a [[D-Bus#D-Bus_session|D-Bus session]] when the greetd session is started. | ||
Line 118: | Line 89: | ||
D-Bus is required for PipeWire and screensharing in Firefox and Chromium. Running with <code>dbus-run-session</code> is a convenience wrapper that will explicitly export the path of the session bus. | D-Bus is required for PipeWire and screensharing in Firefox and Chromium. Running with <code>dbus-run-session</code> is a convenience wrapper that will explicitly export the path of the session bus. | ||
== PipeWire and Screensharing == | === PipeWire and Screensharing === | ||
For audio playback, install [[PipeWire#Installation|PipeWire]]. The sway compositor has no involvement in audio playback. | For audio playback, install [[PipeWire#Installation|PipeWire]]. The sway compositor has no involvement in audio playback. | ||
Line 132: | Line 103: | ||
Launch PipeWire with Sway. Use your service manager of choice, or add the following to sway config: | Launch PipeWire with Sway. Use your service manager of choice, or add the following to sway config: | ||
<pre> | |||
exec /usr/libexec/pipewire-launcher | exec /usr/libexec/pipewire-launcher | ||
</pre> | |||
If your are using automatic D-Bus activation, you also need to set DBus variables for the portal and screensharing features to work: | If your are using automatic D-Bus activation, you also need to set DBus variables for the portal and screensharing features to work: | ||
exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway | exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway | ||
=== Screen lock and suspend-to-RAM === | |||
If [[Elogind]] is not used, consider using {{Pkg|powerctl}}. | |||
Putting the system to sleep with elogind requires elevated privileges or additional configuration. | Putting the system to sleep with elogind requires elevated privileges or additional configuration. | ||
Line 167: | Line 129: | ||
for_window [app_id="^.*"] inhibit_idle fullscreen | for_window [app_id="^.*"] inhibit_idle fullscreen | ||
== Brightness control == | ==== Elogind and swayidle ==== | ||
<code>swayidle</code> has integration with <code>elogind</code> and can handle <code>before-sleep</code> events. | |||
If using <code>swayidle before-sleep</code>, there will be a race condition, so that when you resume the computer from suspend, the screen shows the contents of the unlocked screen for a second before showing the actual lock screen. This can be a privacy concern. | |||
To solve this issue, do the following: | |||
Create this file <code>/etc/elogind/system-sleep/10-swaylock.sh</code>, then add the following script to this file: | |||
#!/bin/sh | |||
if [ "${1}" == "pre" ]; then | |||
touch /tmp/swaylock-sleep | |||
sleep 1 | |||
fi | |||
Then set it to executable. | |||
Later, once sway is installed, add the following line to sway config: | |||
exec touch /tmp/swaylock-sleep && inotifyd swaylock /tmp/swaylock-sleep | |||
With this line, the screen will be promptly locked before suspend-to-RAM starts. | |||
=== Brightness control === | |||
Controlling display backlight requires either the proper udev rules, or using some form of privilege escalation. | Controlling display backlight requires either the proper udev rules, or using some form of privilege escalation. | ||
Line 177: | Line 163: | ||
rc-update add brightnessctl | rc-update add brightnessctl | ||
== Output scaling for high resolution displays == | === Output scaling for high resolution displays === | ||
Without further configuration, program interfaces might be too small to use on high resolution displays. | Without further configuration, program interfaces might be too small to use on high resolution displays. | ||
Line 188: | Line 174: | ||
However, fractional scaling is discouraged due to both the performance impact and the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT based scaling is recommended. See below. | However, fractional scaling is discouraged due to both the performance impact and the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT based scaling is recommended. See below. | ||
To enable Sway scaling, the user can first preview different scaling factors with <code>wdisplays</code> package. Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2. To make changes permanent, add | To enable Sway scaling, the user can first preview different scaling factors with <code>wdisplays</code> package. Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2. To make changes permanent, add below to ~/.config/sway/config. | ||
<pre> | <pre> | ||
output <name> scale <factor> | output <name> scale <factor> | ||
</pre> | </pre> | ||
To use toolkit scaling, use | To use toolkit scaling, use | ||
Line 208: | Line 192: | ||
== Screenshots == | === Screenshots === | ||
A simple tool that works well under Wayland is Grimshot. Example keybindings: | A simple tool that works well under Wayland is Grimshot. Example keybindings: | ||
<pre> | <pre> | ||
Line 218: | Line 202: | ||
See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki's article] for a list of screenshot tools. | See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki's article] for a list of screenshot tools. | ||
=== Make clipboard content persistent === | === Make clipboard content persistent === | ||
By default the clipboard content does not persist after terminating the program: you copy some text from Firefox and then exit Firefox, the copied text is also lost. | By default the clipboard content does not persist after terminating the program: you copy some text from Firefox and then exit Firefox, the copied text is also lost. | ||
Install clipman from testing repo and add the following to sway config: | Install {{Pkg|clipman}} from testing repo and add the following to sway config: | ||
<pre> | <pre> | ||
Line 239: | Line 221: | ||
=== Start with NumLock enabled === | === Start with NumLock enabled === | ||
Add this to your sway config file: | Add this to your sway config file: | ||
input type:keyboard xkb_numlock enabled | |||
=== Change mouse cursor theme and size === | === Change mouse cursor theme and size === | ||
Add to your sway config: | Add to your sway config: | ||
Line 267: | Line 251: | ||
See [[Fontconfig]] | See [[Fontconfig]] | ||
= Troubleshooting = | == Troubleshooting == | ||
If you encounter any issues, try running <code>sway -Vc /etc/sway/config</code>. It will run sway with the default config file and set the output to be more verbose. It is generally a good idea to track your config files with git (when and if at all you use a remote repository for them, keep it private for security reasons). | If you encounter any issues, try running <code>sway -Vc /etc/sway/config</code>. It will run sway with the default config file and set the output to be more verbose. It is generally a good idea to track your config files with git (when and if at all you use a remote repository for them, keep it private for security reasons). | ||
Line 276: | Line 260: | ||
Alternately, you can also issue the below command from TTY. | Alternately, you can also issue the below command from TTY. | ||
{{cmd|$ sway -d 2> ~/sway_error.log}} | {{cmd|$ sway -d 2> ~/sway_error.log}} | ||
=== Video Driver Issues === | |||
After installing sway, while launching it for the first time, lack of proper [[#Install Graphics Drivers|video drivers]] causes various error messages such as: | |||
* "unable to create backend" | |||
* "Failed to create renderer" | |||
Do install necessary drivers for your [[#Install Graphics Drivers|graphics card]] for sway to work. | |||
=== Flatpaks === | === Flatpaks === | ||
{{main|Flatpak}} | {{main|Flatpak}} | ||
Due to their sandboxing, flatpaks require the use of a portal frontend (xdg-desktop-portal) and backends (such as xdg-desktop-portal-wlr, xdg-desktop-portal-gtk, xdg-desktop-portal-gnome) that implement the methods. When in doubt, install multiple backends. For more information on backends, see [https://github.com/flatpak/xdg-desktop-portal/#using-portals flatpak's page on the subject]. In addition to the steps under the "Firefox Screensharing" section, it may also be necessary to launch additional backends in your Sway config file. Otherwise, you may run into GDBus errors as your flatpak fails to interface with the portal. This can cause issues such as with opening your file directories from a flatpak application. | Due to their sandboxing, flatpaks require the use of a portal frontend (xdg-desktop-portal) and backends (such as xdg-desktop-portal-wlr, xdg-desktop-portal-gtk, xdg-desktop-portal-gnome) that implement the methods. When in doubt, install multiple backends. For more information on backends, see [https://github.com/flatpak/xdg-desktop-portal/#using-portals flatpak's page on the subject]. In addition to the steps under the "Firefox Screensharing" section, it may also be necessary to launch additional backends in your Sway config file. Otherwise, you may run into GDBus errors as your flatpak fails to interface with the portal. This can cause issues such as with opening your file directories from a flatpak application. | ||
Line 297: | Line 290: | ||
Go to ''about:config'' and set <code>widget.use-xdg-desktop-portal.file-picker</code> to 0. | Go to ''about:config'' and set <code>widget.use-xdg-desktop-portal.file-picker</code> to 0. | ||
=== Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start === | === Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start === | ||
Line 304: | Line 298: | ||
See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[tmux]] | See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[tmux]] | ||
== See Also == | == See Also == |
Revision as of 11:02, 9 October 2024
Sway 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.
- Create a non-privileged user account for security reasons, if you skipped this step during Installation.
- Enable community repository. Setup-desktop script automatically does this for you.
- Install graphics driver for your video hardware.
Installation using setup-desktop
The Alpine Linux script for setting up a desktop quickly is setup-desktop.
# setup-desktop
On running the above command, you will be prompted to select a desktop environment.
Which desktop environment? ('gnome', 'plasma', 'xfce', 'mate', 'sway' or 'none') [none]
Once you have chosen a desktop environment, this script installs the chosen desktop along with all the necessary packages, firefox browser and adds the necessary services to run on startup. You can reboot when complete and the system will boot into a graphical login screen with the desktop environment. Depending on the desktop chosen, the script also activates the necessary services like dbus, elogind, login manager etc..
To view all the packages that are installed by the script for the chosen desktop you can issue the below command:
# cat /sbin/setup-desktop
The above command installs wayland-base which includes elogind, polkit-elogind, eudev and the following packages dmenu, font-dejavu , foot, grim, i3status, sway, swayidle, swaylockd, util-linux-login, wl-clipboard, wmenu, xwayland
Since the above utility pulls in all the necessary dependencies except video and starts necessary services, you can launch sway by issuing the command sway
from TTY.
$ sway
Manual Installation
The below installation step allows you to pick and choose various componenents for your Sway Desktop.
Add a normal user
Use setup-user
to add a non-system normal user for running Sway.
# setup-user
Set up eudev
eudev is recommended and required for. Without it, sway cannot connect to input devices.
# setup-devd udev
Install Graphics Drivers
Many desktop environments need a graphics driver to work properly. Graphics cards of recent vintage need a driver to work. So one needs to install one of the below graphics drivers before installing a desktop:
Information about the video cards that are installed in the computer may be found using lspci
command, which is not available by default. Refer the instructions to install pciutils package.
To identify the graphics card (the Subsystem output shows the specific model), issue the below command:
lspci -v | grep -A1 -e VGA -e 3D
Then, install an appropriate driver.
- For Intel video chipsets, see Intel Video
- For AMD Radeon Chipsets, see Radeon Video
- For Nvidia Chipsets, see Nvidia Video
To install X11 based desktop, you may want to install specific Xorg xf86 driver packages for your video card's chipset, as they may support specific features, effects and acceleration modes, and avoid error messages during X initialization. However, the most basic X features should work fine with just using the default kernel video-modesetting drivers.
To see available xf86 video driver packages run:
$ apk search xf86-video
- For Sis video chipset install xf86-video-sis
- For VMware guests use xf86-video-vmware
- For VirtualBox guests use xf86-video-vboxvideo. Refer VirtualBox guest additions
- For Hyper-V guests use xf86-video-fbdev. Refer Hyper-V guest services.
- For KVM/QEMU guests refer Xorg within QEMU
Setting up a seat manager
Wayland compositors need raw access to input and output devices. This is mediated by a seat manager. Using either seatd or elogind is supported. Using both may lead to conflicts.
Install seatd
See Seatd for the mandatory steps needed for sway to work with seatd.
Install elogind
See Elogind.
Install greetd (optional)
See greetd
Install fonts
Install DejaVu fonts, which has good Unicode coverage:
# apk add font-dejavu
Install Sway
# apk add sway \ xwayland \ # if you need xserver foot \ # default terminal emulator. Modify $term in config for a different one. wmenu \ # default wayland native menu for choosing program and screensharing monitor swaylock swaylockd \ # lockscreen tool swaybg \ # display wallpaper grim \ # screenshot tool wl-clipboard \ # clipboard management i3status \ # simple status bar swayidle # idle management (DPMS) daemon
For complimentary software alternatives, see the relevant page from sway's wiki or this list at Gentoo Wiki.
Configuration
Copy default sway configuration to ~/.config
:
$ mkdir -p ~/.config/sway $ cp /etc/sway/config ~/.config/sway/
Read through it to learn the default keybindings. Sway configuration is mostly backwards-compatible with that of i3 and if you are looking for a solution for a specific issue, you may also try checking if it hasn't been provided for i3WM.
For additional information, start at man 5 sway
and read the upstream wiki.
Starting sway
One can launch sway by issuing the command sway from TTY.
$ sway
You can also sway with a greeter like greetd. In this case, to start sway session for the user, you might want to start a D-Bus session when the greetd session is started.
Contents of /etc/greetd/environments
D-Bus is required for PipeWire and screensharing in Firefox and Chromium. Running with dbus-run-session
is a convenience wrapper that will explicitly export the path of the session bus.
PipeWire and Screensharing
For audio playback, install PipeWire. The sway compositor has no involvement in audio playback.
For screen sharing, applications are split into two categories:
- Those which use the native wayland protocol, wlr-screencopy
- Those which use the API from Flatpak's
xdg-desktop-portal
(this portal is also used by native non-Flatpak applications).
Applications in the first group require no additional setup. Applications in the second group (which includes Firefox and Chromium) require setting up xdg portals in addition to PipeWire.
# apk add xdg-desktop-portal xdg-desktop-portal-wlr
Launch PipeWire with Sway. Use your service manager of choice, or add the following to sway config:
exec /usr/libexec/pipewire-launcher
If your are using automatic D-Bus activation, you also need to set DBus variables for the portal and screensharing features to work:
exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
Screen lock and suspend-to-RAM
If Elogind is not used, consider using powerctl.
Putting the system to sleep with elogind requires elevated privileges or additional configuration.
For details on configuring doas
with elogind
, see Elogind#Doas
To put the system to sleep after 600 seconds, use:
exec swayidle -w timeout 600 'doas /bin/loginctl suspend'
loginctl suspend command will trigger the screenlock, as mentioned in the section Install elogind (optional) above.
Do not lock the screen if program is running in full screen:
for_window [app_id="^.*"] inhibit_idle fullscreen
Elogind and swayidle
swayidle
has integration with elogind
and can handle before-sleep
events.
If using swayidle before-sleep
, there will be a race condition, so that when you resume the computer from suspend, the screen shows the contents of the unlocked screen for a second before showing the actual lock screen. This can be a privacy concern.
To solve this issue, do the following:
Create this file /etc/elogind/system-sleep/10-swaylock.sh
, then add the following script to this file:
#!/bin/sh if [ "${1}" == "pre" ]; then touch /tmp/swaylock-sleep sleep 1 fi
Then set it to executable.
Later, once sway is installed, add the following line to sway config:
exec touch /tmp/swaylock-sleep && inotifyd swaylock /tmp/swaylock-sleep
With this line, the screen will be promptly locked before suspend-to-RAM starts.
Brightness control
Controlling display backlight requires either the proper udev rules, or using some form of privilege escalation.
brightnessctl is a reliable alternative, although its default udev rules require too wide permissions (see #15409). You may need your own rules, or configure doas to allow running it as an unprivileged user.
Optionally enable brightnessctl service to restore brightness settings on reboot:
rc-update add brightnessctl
Output scaling for high resolution displays
Without further configuration, program interfaces might be too small to use on high resolution displays.
Sway supports the per-display configuration of
- fractional (e.g., 1.5x), and
- integer scaling (e.g., 2x)
However, fractional scaling is discouraged due to both the performance impact and the blurry output it produces. In this case, where 1x scaling is too small and 2x scaling is too large, program-specific GTK/QT based scaling is recommended. See below.
To enable Sway scaling, the user can first preview different scaling factors with wdisplays
package. Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2. To make changes permanent, add below to ~/.config/sway/config.
output <name> scale <factor>
To use toolkit scaling, use
# for GTK-based programs such as firefox and emacs: export GDK_DPI_SCALE=2 # for QT-based programs export QT_WAYLAND_FORCE_DPI="physical" # or if still too small, use a custom DPI export QT_WAYLAND_FORCE_DPI=192 # 2x scaling export QT_QPA_PLATFORM="wayland-egl"
Screenshots
A simple tool that works well under Wayland is Grimshot. Example keybindings:
bindsym Print exec grimshot copy area bindsym Shift+Print exec grimshot copy screen bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png
See the sway wiki's article for a list of screenshot tools.
Make clipboard content persistent
By default the clipboard content does not persist after terminating the program: you copy some text from Firefox and then exit Firefox, the copied text is also lost.
Install clipman from testing repo and add the following to sway config:
exec wl-paste --type text/plain --watch clipman store --histpath="~/.local/state/clipman-primary.json" bindsym $mod+h exec clipman pick --tool wofi --histpath="~/.local/state/clipman-primary.json"
Firefox picture-in-picture mode/floating windows
Add this to your sway config file (modify the numeric values to suit your needs and your display):
for_window [app_id="firefox" title="^Picture-in-Picture$"] floating enable, move position 877 450, sticky enable, border none
Start with NumLock enabled
Add this to your sway config file:
input type:keyboard xkb_numlock enabled
Change mouse cursor theme and size
Add to your sway config:
seat seat0 xcursor_theme my_cursor_theme my_cursor_size
For example, set a mouse cursor, using GNOME Adwaita theme:
seat seat0 xcursor_theme Adwaita 16
You can inspect their values with echo $XCURSOR_SIZE
and echo $XCURSOR_THEME
. If reloading your config does not result in change, try logging out and in.
$XCURSOR_SIZE
and $XCURSOR_THEME
.Custom keyboard layout
To use custom keyboard layout, just use
input type:keyboard { xkb_file /path/to/my/custom/layout }
Changing default application fonts
See Fontconfig
Troubleshooting
If you encounter any issues, try running sway -Vc /etc/sway/config
. It will run sway with the default config file and set the output to be more verbose. It is generally a good idea to track your config files with git (when and if at all you use a remote repository for them, keep it private for security reasons).
To capture the sway error log in a file for troubleshooting, replace sway
in your startup file by
sway -d 2> ~/sway_error.log
.
Alternately, you can also issue the below command from TTY.
$ sway -d 2> ~/sway_error.log
Video Driver Issues
After installing sway, while launching it for the first time, lack of proper video drivers causes various error messages such as:
- "unable to create backend"
- "Failed to create renderer"
Do install necessary drivers for your graphics card for sway to work.
Flatpaks
Due to their sandboxing, flatpaks require the use of a portal frontend (xdg-desktop-portal) and backends (such as xdg-desktop-portal-wlr, xdg-desktop-portal-gtk, xdg-desktop-portal-gnome) that implement the methods. When in doubt, install multiple backends. For more information on backends, see flatpak's page on the subject. In addition to the steps under the "Firefox Screensharing" section, it may also be necessary to launch additional backends in your Sway config file. Otherwise, you may run into GDBus errors as your flatpak fails to interface with the portal. This can cause issues such as with opening your file directories from a flatpak application.
After installing different backends, you might need to add the relevant backends to your sway config file similarly to in the "Firefox Screensharing" section above. For example, an autostart section of your sway config file may include:
exec /usr/libexec/xdg-desktop-portal-gtk exec /usr/libexec/xdg-desktop-portal-wlr exec /usr/libexec/xdg-desktop-portal-gnome
This is only needed if they are not started automatically via other means.
Firefox (Flatpak) and/or GTK apps
Disappearing cursor
You may need to get an icon pack and possibly a theme from Pling store and set GTK_THEME
environmental variable. Alternatively you can install a theme for all users (search Alpine Linux Packages for *-icon-theme) using apk add
.
Missing file picker/cannot download
Go to about:config and set widget.use-xdg-desktop-portal.file-picker
to 0.
Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start
As of Dec 31 2022, Nvidia still doesn't fully support Wayland. Therefore, the possible solutions are as outlined in the link, or setting your WLR_BACKENDS environmental variables to drm,libinput
or x11
(add libinput here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (make sure to install libinput first).
Sway socket not detected
See Installation for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as tmux