<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CRBrechin</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CRBrechin"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/CRBrechin"/>
	<updated>2026-05-05T11:11:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23029</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23029"/>
		<updated>2023-03-01T18:58:55Z</updated>

		<summary type="html">&lt;p&gt;CRBrechin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://swaywm.org Sway] is a tiling [[Wayland]] compositor. It&#039;s a drop-in replacement for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget, you will need to add the community repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ whoami&lt;br /&gt;
user&lt;br /&gt;
$ su &lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# echo $USER # just so that we know we retained the same environment variables&lt;br /&gt;
user&lt;br /&gt;
# # if the output is &#039;root&#039; then we know we must have logged in using &#039;su -&#039;&lt;br /&gt;
# cat /etc/apk/repositories&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# # You can edit the files in vi and remove the comment &#039;#&#039; from the line that has &amp;lt;version&amp;gt;/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have updated the file manually you can continue to the [[Installation|installation]] step.&lt;br /&gt;
&lt;br /&gt;
{{Tip| Or you can run something &amp;lt;strong&amp;gt;ridiculous&amp;lt;/strong&amp;gt; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# tFILE=&#039;/etc/apk/repositories&#039;&lt;br /&gt;
# line=&amp;quot;$(cat $tFILE | grep -E &amp;quot;^#.*alpine/v.*/community&amp;quot; | cut -f1 -d:)&amp;quot; # add the comments so that it doesn&#039;t run everytime&lt;br /&gt;
# awk -v line=$line &#039;FNR == line { sub(&amp;quot;#&amp;quot;,&amp;quot;&amp;quot;); print } FNR != line { print }&#039; $tFILE &amp;gt; $tFILE.upd&lt;br /&gt;
# cat $tFILE.upd # if everything is correct after inspection then we can move it over&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# cp $tFILE $tFILE.bak # just in case the hairbrained idea doesn&#039;t work&lt;br /&gt;
# cat $tFILE.upd &amp;gt; $tFILE; rm $tFILE.upd # we want to keep the file permissions so don&#039;t use cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
eudev:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# rc-update # let&#039;s look at the services that are configured for each run-level&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add eudev&lt;br /&gt;
# setup-devd udev&lt;br /&gt;
# rc-update # we can now see the services that have been added by the setup script&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Graphics drivers:&lt;br /&gt;
&lt;br /&gt;
* [[Intel Video]]&lt;br /&gt;
* [[Radeon Video]]&lt;br /&gt;
* [[Nvidia Video]]&lt;br /&gt;
Add user to the input and video groups:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# echo $USER&lt;br /&gt;
user&lt;br /&gt;
# adduser $USER input&lt;br /&gt;
# adduser $USER video&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install some TTF fonts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add ttf-dejavu&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
seatd daemon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# # if we like we can look at the services again using rc-update&lt;br /&gt;
# apk add seatd&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# rc-update add seatd&lt;br /&gt;
# # and then look again to compare&lt;br /&gt;
# rc-service seatd start&lt;br /&gt;
# adduser $USER seat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install sway:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add sway sway-doc&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add                \ # Install optional dependencies:&lt;br /&gt;
    xwayland             \ # recommended for compatibility reasons&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    bemenu               \ # wayland menu&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # wallpaper daemon&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
For inter-program communication and functionality such as screensharing, install and enable dbus and PipeWire, see [[PipeWire]] and set &amp;lt;code&amp;gt;SWAYSOCK&amp;lt;/code&amp;gt; environmental variable to the value exported by &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt;. In order to ensure that Pipewire and related services inherit the right environment variables, it is recommended to start these services via a process that is a direct descendant of sway itself.&lt;br /&gt;
&lt;br /&gt;
Launch Sway with a D-Bus server available, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dbus-run-session -- sway #prepend with exec in your login shell init script&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
An example config is provided at &amp;lt;code&amp;gt;/etc/sway/config&amp;lt;/code&amp;gt;. Copy it to &amp;lt;code&amp;gt;~/.config/sway/config&amp;lt;/code&amp;gt; and read through it to learn the default keybindings.&lt;br /&gt;
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&#039;t been provided for i3WM.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== Firefox screensharing ===&lt;br /&gt;
&lt;br /&gt;
For some programs, additional configuration is needed to launch them natively under Wayland and to support special features such as screen sharing.&lt;br /&gt;
&lt;br /&gt;
To launch Firefox natively under Wayland and to enable support for screensharing, you need:&lt;br /&gt;
&lt;br /&gt;
* Install and configure [[PipeWire]]&lt;br /&gt;
* Install xdg-desktop-portal and xdg-desktop-portal-wlr package&lt;br /&gt;
* Install wofi for screen selection&lt;br /&gt;
* Launch support programs on sway startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/pipewire-launcher #pipewire must be launched first&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Export the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=&amp;quot;1&amp;quot;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
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-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&#039;s page on the subject]. In addition to the steps under the &amp;quot;Firefox Screensharing&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
After installing different backends, you might need to add the relevant backends to your sway config file similarly to in the &amp;quot;Firefox Screensharing&amp;quot; section above. For example, an autostart section of your sway config file may include:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gnome&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is only needed if they are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
=== Scaling for high resolution screens ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces might be too small to use on high resolution screens.&lt;br /&gt;
&lt;br /&gt;
==== Via sway ====&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g., 1.5x), and&lt;br /&gt;
* integer scaling (e.g., 2x) &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with &amp;lt;code&amp;gt;wdisplays&amp;lt;/code&amp;gt; package.  Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2.  To make changes permanent, add&lt;br /&gt;
&lt;br /&gt;
[[#output|output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;]] to ~/.config/sway/config&lt;br /&gt;
&lt;br /&gt;
==== Via GTK/Qt ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for GTK-based programs such as firefox and emacs:&lt;br /&gt;
export GDK_DPI_SCALE=2&lt;br /&gt;
&lt;br /&gt;
# for QT-based programs&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=&amp;quot;physical&amp;quot;&lt;br /&gt;
# or if still too small, use a custom DPI&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=192 # 2x scaling&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Make clipboard content persistent ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Install clipman from test repo and add the following to sway config:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox picture-in-picture mode/floating windows ===&lt;br /&gt;
Add this to your sway config file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
A simple tool that works well under Wayland is Grimshot. Example keybindings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki&#039;s article] for a list of screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock enabled ===&lt;br /&gt;
Add this to your sway config file:&lt;br /&gt;
&amp;lt;code&amp;gt;input type:keyboard xkb_numlock enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change cursor theme and size ===&lt;br /&gt;
Add to your sway config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your config does not result in change, try logging out and in.&lt;br /&gt;
{{Note|Wayland uses client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Start as a service ===&lt;br /&gt;
Although this is not necessary, you may write an init script like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{/etc/init.d/sway|&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
description=&amp;quot;Sway Compositor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
command=&amp;quot;/usr/bin/sway&amp;quot;&lt;br /&gt;
command_args=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
pidfile=&amp;quot;/run/sway.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--background --pidfile ${pidfile}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
  need localmount&lt;br /&gt;
  after elogind&lt;br /&gt;
  use seatd dbus&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then as a root run &amp;lt;code&amp;gt;chmod +x /etc/init.d/seat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rc-update add sway default&amp;lt;/code&amp;gt;. Make sure you have elogind installed or specify another service, like your display/login manager after which the sway service will run.&lt;br /&gt;
&lt;br /&gt;
=== Custom keyboard layout ===&lt;br /&gt;
&lt;br /&gt;
Since wayland does not support setxkbmap, you will also need to add similar content to your &#039;&#039;/usr/share/X11/xkb/rules/evdev.xml&#039;&#039;, after &amp;lt;code&amp;gt;&amp;lt;/modelList&amp;gt;&amp;lt;/code&amp;gt; and after &amp;lt;code&amp;gt;&amp;lt;layoutList&amp;gt;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
      &amp;lt;configItem&amp;gt;&lt;br /&gt;
        &amp;lt;name&amp;gt;[the name of your layout, same as the name of the file in /usr/share/X11/xkb/symbols]&amp;lt;/name&amp;gt;&lt;br /&gt;
        &amp;lt;shortDescription&amp;gt;[usually just two letters]&amp;lt;/shortDescription&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;[description of your layout]&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;countryList&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;US&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;NO&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
        &amp;lt;/countryList&amp;gt;&lt;br /&gt;
        &amp;lt;languageList&amp;gt;&lt;br /&gt;
          &amp;lt;iso639Id&amp;gt;eng&amp;lt;/iso639Id&amp;gt;&lt;br /&gt;
        &amp;lt;/languageList&amp;gt;&lt;br /&gt;
      &amp;lt;/configItem&amp;gt;&lt;br /&gt;
    &amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;!--[other layouts]--&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, to enable for all keyboards, navigate to the input section of &#039;&#039;~/.config/sway/config&#039;&#039; and modify it to &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input * {&lt;br /&gt;
  xkb_layout &amp;quot;my_layout&amp;quot; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you have enabled &amp;lt;code&amp;gt;xkb_numlock&amp;lt;/code&amp;gt;, include this setting inside those braces as well.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/code&amp;gt;. 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). &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK apps ===&lt;br /&gt;
==== Disappearing cursor ====&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively you can install a theme for all users (search [https://pkgs.alpinelinux.org/ Alpine Linux Packages] for &#039;&#039;*-icon-theme&#039;&#039;) using &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start ===&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your WLR_BACKENDS environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add libinput here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install libinput first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
=== Sway socket not detected ===&lt;br /&gt;
&lt;br /&gt;
See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[Tmux terminal multiplexer|tmux]]&lt;br /&gt;
&lt;br /&gt;
=== Sway freezes after loading and no input works ===&lt;br /&gt;
&lt;br /&gt;
You probably forgot to add yourself to the input/video groups detailed under &amp;lt;code&amp;gt;installation&amp;lt;/code&amp;gt; above. &lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
[[Category:Desktop]]&lt;/div&gt;</summary>
		<author><name>CRBrechin</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23019</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23019"/>
		<updated>2023-02-28T06:08:29Z</updated>

		<summary type="html">&lt;p&gt;CRBrechin: Added a section for novice questions and detailed a few more troubleshooting steps&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://swaywm.org Sway] is a tiling [[Wayland]] compositor. It&#039;s a drop-in replacement for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget, you will need to add the community repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ whoami&lt;br /&gt;
user&lt;br /&gt;
$ su &lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# echo $USER # just so that we know we retained the same environment variables&lt;br /&gt;
user&lt;br /&gt;
# # if the output is &#039;root&#039; then we know we must have logged in using &#039;su -&#039;&lt;br /&gt;
# cat /etc/apk/repositories&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# # You can edit the files in vi and remove the comment &#039;#&#039; from the line that has &amp;lt;version&amp;gt;/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have updated the file manually you can continue to the [[Installation|installation]] step.&lt;br /&gt;
&lt;br /&gt;
{{Tip| Or you can run something &amp;lt;strong&amp;gt;ridiculous&amp;lt;/strong&amp;gt; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# tFILE=&#039;/etc/apk/repositories&#039;&lt;br /&gt;
# line=&amp;quot;$(cat $tFILE | grep -E &amp;quot;^#.*alpine/v.*/community&amp;quot; | cut -f1 -d:)&amp;quot; # add the comments so that it doesn&#039;t run everytime&lt;br /&gt;
# awk -v line=$line &#039;FNR == line { sub(&amp;quot;#&amp;quot;,&amp;quot;&amp;quot;); print } FNR != line { print }&#039; $tFILE &amp;gt; $tFILE.upd&lt;br /&gt;
# cat $tFILE.upd # if everything is correct after inspection then we can move it over&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# cp $tFILE $tFILE.bak # just in case the hairbrained idea doesn&#039;t work&lt;br /&gt;
# cat $tFILE.upd &amp;gt; $tFILE; rm $tFILE.upd # we want to keep the file permissions so don&#039;t use cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
eudev:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# rc-update # let&#039;s look at the services that are configured for each run-level&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add eudev&lt;br /&gt;
# setup-devd udev&lt;br /&gt;
# rc-update # we can now see the services that have been added by the setup script&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Graphics drivers:&lt;br /&gt;
&lt;br /&gt;
* [[Intel Video]]&lt;br /&gt;
* [[Radeon Video]]&lt;br /&gt;
* [[Nvidia Video]]&lt;br /&gt;
Add user to the input and video groups:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# echo $USER&lt;br /&gt;
user&lt;br /&gt;
# adduser $USER input&lt;br /&gt;
# adduser $USER video&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install some TTF fonts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add ttf-dejavu&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
seatd daemon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# # if we like we can look at the services again using rc-update&lt;br /&gt;
# apk add seatd&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# rc-update add seatd&lt;br /&gt;
# # and then look again to compare&lt;br /&gt;
# rc-service seatd start&lt;br /&gt;
# adduser $tempUSER seat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install sway:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add sway sway-doc&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add                \ # Install optional dependencies:&lt;br /&gt;
    xwayland             \ # recommended for compatibility reasons&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    bemenu               \ # wayland menu&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # wallpaper daemon&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
For inter-program communication and functionality such as screensharing, install and enable dbus and PipeWire, see [[PipeWire]] and set &amp;lt;code&amp;gt;SWAYSOCK&amp;lt;/code&amp;gt; environmental variable to the value exported by &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt;. In order to ensure that Pipewire and related services inherit the right environment variables, it is recommended to start these services via a process that is a direct descendant of sway itself.&lt;br /&gt;
&lt;br /&gt;
Launch Sway with a D-Bus server available, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dbus-run-session -- sway #prepend with exec in your login shell init script&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
An example config is provided at &amp;lt;code&amp;gt;/etc/sway/config&amp;lt;/code&amp;gt;. Copy it to &amp;lt;code&amp;gt;~/.config/sway/config&amp;lt;/code&amp;gt; and read through it to learn the default keybindings.&lt;br /&gt;
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&#039;t been provided for i3WM.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== Firefox screensharing ===&lt;br /&gt;
&lt;br /&gt;
For some programs, additional configuration is needed to launch them natively under Wayland and to support special features such as screen sharing.&lt;br /&gt;
&lt;br /&gt;
To launch Firefox natively under Wayland and to enable support for screensharing, you need:&lt;br /&gt;
&lt;br /&gt;
* Install and configure [[PipeWire]]&lt;br /&gt;
* Install xdg-desktop-portal and xdg-desktop-portal-wlr package&lt;br /&gt;
* Install wofi for screen selection&lt;br /&gt;
* Launch support programs on sway startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/pipewire-launcher #pipewire must be launched first&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Export the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=&amp;quot;1&amp;quot;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
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-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&#039;s page on the subject]. In addition to the steps under the &amp;quot;Firefox Screensharing&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
After installing different backends, you might need to add the relevant backends to your sway config file similarly to in the &amp;quot;Firefox Screensharing&amp;quot; section above. For example, an autostart section of your sway config file may include:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gnome&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is only needed if they are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
=== Scaling for high resolution screens ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces might be too small to use on high resolution screens.&lt;br /&gt;
&lt;br /&gt;
==== Via sway ====&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g., 1.5x), and&lt;br /&gt;
* integer scaling (e.g., 2x) &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with &amp;lt;code&amp;gt;wdisplays&amp;lt;/code&amp;gt; package.  Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2.  To make changes permanent, add&lt;br /&gt;
&lt;br /&gt;
[[#output|output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;]] to ~/.config/sway/config&lt;br /&gt;
&lt;br /&gt;
==== Via GTK/Qt ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for GTK-based programs such as firefox and emacs:&lt;br /&gt;
export GDK_DPI_SCALE=2&lt;br /&gt;
&lt;br /&gt;
# for QT-based programs&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=&amp;quot;physical&amp;quot;&lt;br /&gt;
# or if still too small, use a custom DPI&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=192 # 2x scaling&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Make clipboard content persistent ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Install clipman from test repo and add the following to sway config:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox picture-in-picture mode/floating windows ===&lt;br /&gt;
Add this to your sway config file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
A simple tool that works well under Wayland is Grimshot. Example keybindings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki&#039;s article] for a list of screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock enabled ===&lt;br /&gt;
Add this to your sway config file:&lt;br /&gt;
&amp;lt;code&amp;gt;input type:keyboard xkb_numlock enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change cursor theme and size ===&lt;br /&gt;
Add to your sway config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your config does not result in change, try logging out and in.&lt;br /&gt;
{{Note|Wayland uses client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Start as a service ===&lt;br /&gt;
Although this is not necessary, you may write an init script like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{/etc/init.d/sway|&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
description=&amp;quot;Sway Compositor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
command=&amp;quot;/usr/bin/sway&amp;quot;&lt;br /&gt;
command_args=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
pidfile=&amp;quot;/run/sway.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--background --pidfile ${pidfile}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
  need localmount&lt;br /&gt;
  after elogind&lt;br /&gt;
  use seatd dbus&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then as a root run &amp;lt;code&amp;gt;chmod +x /etc/init.d/seat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rc-update add sway default&amp;lt;/code&amp;gt;. Make sure you have elogind installed or specify another service, like your display/login manager after which the sway service will run.&lt;br /&gt;
&lt;br /&gt;
=== Custom keyboard layout ===&lt;br /&gt;
&lt;br /&gt;
Since wayland does not support setxkbmap, you will also need to add similar content to your &#039;&#039;/usr/share/X11/xkb/rules/evdev.xml&#039;&#039;, after &amp;lt;code&amp;gt;&amp;lt;/modelList&amp;gt;&amp;lt;/code&amp;gt; and after &amp;lt;code&amp;gt;&amp;lt;layoutList&amp;gt;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
      &amp;lt;configItem&amp;gt;&lt;br /&gt;
        &amp;lt;name&amp;gt;[the name of your layout, same as the name of the file in /usr/share/X11/xkb/symbols]&amp;lt;/name&amp;gt;&lt;br /&gt;
        &amp;lt;shortDescription&amp;gt;[usually just two letters]&amp;lt;/shortDescription&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;[description of your layout]&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;countryList&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;US&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;NO&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
        &amp;lt;/countryList&amp;gt;&lt;br /&gt;
        &amp;lt;languageList&amp;gt;&lt;br /&gt;
          &amp;lt;iso639Id&amp;gt;eng&amp;lt;/iso639Id&amp;gt;&lt;br /&gt;
        &amp;lt;/languageList&amp;gt;&lt;br /&gt;
      &amp;lt;/configItem&amp;gt;&lt;br /&gt;
    &amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;!--[other layouts]--&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, to enable for all keyboards, navigate to the input section of &#039;&#039;~/.config/sway/config&#039;&#039; and modify it to &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input * {&lt;br /&gt;
  xkb_layout &amp;quot;my_layout&amp;quot; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you have enabled &amp;lt;code&amp;gt;xkb_numlock&amp;lt;/code&amp;gt;, include this setting inside those braces as well.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/code&amp;gt;. 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). &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK apps ===&lt;br /&gt;
==== Disappearing cursor ====&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively you can install a theme for all users (search [https://pkgs.alpinelinux.org/ Alpine Linux Packages] for &#039;&#039;*-icon-theme&#039;&#039;) using &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start ===&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your WLR_BACKENDS environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add libinput here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install libinput first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
=== Sway socket not detected ===&lt;br /&gt;
&lt;br /&gt;
See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[Tmux terminal multiplexer|tmux]]&lt;br /&gt;
&lt;br /&gt;
=== Sway freezes after loading and no iput works ===&lt;br /&gt;
You can move to a new &amp;lt;code&amp;gt;tty&amp;lt;/code&amp;gt; [&amp;lt;code&amp;gt;CTRL&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;ALT&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;F&amp;lt;n&amp;gt;&amp;lt;/code&amp;gt;; where &amp;lt;code&amp;gt;&amp;lt;n&amp;gt;&amp;lt;/code&amp;gt; is a number Fkey on your keyboard], login as root, and kill all the processes that are linked to the problem &amp;lt;code&amp;gt;tty&amp;lt;/code&amp;gt;.&lt;br /&gt;
{{Tip|Something like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i in $(ps | awk &#039;{ if($2==&amp;lt;user&amp;gt;) { print $1 } }&#039;); do&lt;br /&gt;
&amp;gt; kill -9 $i&lt;br /&gt;
&amp;gt; done # don&#039;t forget to replace &amp;lt;user&amp;gt; with the user of the frozen tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
&lt;br /&gt;
== Novice Questions ==&lt;br /&gt;
&lt;br /&gt;
=== What if the services &amp;lt;var&amp;gt;hwdrivers&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;mdev&amp;lt;/var&amp;gt; are not in the &amp;lt;var&amp;gt;sysinit&amp;lt;/var&amp;gt; run-level? ===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;udev performs its own hwdrivers module detection, it does not need the additional service. We delete the hwdrivers service when enabling udev, and add it when enabling mdev and mdevd.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://gitlab-test.alpinelinux.org/alpine/alpine-conf/-/merge_requests/100 alpine-conf]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What does &amp;lt;var&amp;gt;seatd&amp;lt;/var&amp;gt; do? ===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;Seat management takes care of mediating access to shared devices (graphics, input), without requiring the applications needing access to be root.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://sr.ht/~kennylevinsen/seatd/ sourcehut]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What if I run into a problem with sway? ===&lt;br /&gt;
You can always check the version that you are running. But problems like the following error can occur:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
Error loading shared library libjson-c.so.5: I/O error (needed by /usr/bin/sway)&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When this error occurred I was experiencing trouble with the filesystem. The filesystem had *booped* itself into &amp;lt;var&amp;gt;read-only mode&amp;lt;/var&amp;gt;. A reboot fixed this error.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
sway version 1.7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Where is good Alpine documentation? ===&lt;br /&gt;
Try here for reading.&lt;br /&gt;
[[gitlab.alpinelinux.org/alpine/aports/-/issues|gitlab.alpinelinux.org/alpine/aports/-/issues]]&lt;br /&gt;
&lt;br /&gt;
=== How do I debug the launch of Sway? ===&lt;br /&gt;
I ran &amp;lt;code&amp;gt;sway -Vc /home/&amp;lt;user&amp;gt;/.config/sway/config&amp;lt;/code&amp;gt; as root so that I would experience an error and not complete.&lt;br /&gt;
&lt;br /&gt;
=== What happens if &amp;lt;var&amp;gt;SWAYSOCK&amp;lt;/var&amp;gt; is empty? ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Swaylock|https://github.com/swaywm/swaylock/blob/master/README.md]]&lt;br /&gt;
&lt;br /&gt;
=== What happens if &amp;lt;var&amp;gt;LD_LIBRARY_PATH&amp;lt;/var&amp;gt; is empty? ===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;LD_PRELOAD (not LD_PRELOAD_PATH) is a list of specific libraries (files) to be loaded before any other libraries, whether the program wants it or not. LD_LIBRARY_PATH is a list of directories to search when loading libraries that would have been loaded anyway. On linux you can read man ld.so for more information about these and other environment variables that affect the dynamic linker.&amp;quot;&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
{{Define|Source|[https://stackoverflow.com/questions/14715175/what-is-the-difference-between-ld-preload-path-and-ld-library-path]}}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;When should I set LD_LIBRARY_PATH?&lt;br /&gt;
The short answer is never.&lt;br /&gt;
&lt;br /&gt;
Why?&lt;br /&gt;
Some users seem to set this environment variable because of bad advice from other users or badly linked code that they do not know how to fix.&amp;quot;&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
{{Define|Source|[http://linuxmafia.com/faq/Admin/ld-lib-path.html]}}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
{{Define|Source|[http://linuxmafia.com/faq/Admin/ld-lib-path.html]}}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|ENVIRONMENT&lt;br /&gt;
The following environment variables have an effect on sway:&lt;br /&gt;
&lt;br /&gt;
SWAYSOCK&lt;br /&gt;
&lt;br /&gt;
Specifies the path to the sway IPC socket.&lt;br /&gt;
XKB_DEFAULT_RULES, XKB_DEFAULT_MODEL, XKB_DEFAULT_LAYOUT, XKB_DEFAULT_VARIANT, XKB_DEFAULT_OPTIONS&lt;br /&gt;
&lt;br /&gt;
Configures the xkb keyboard settings. See xkeyboard-config(7). The preferred way to configure the keyboard is via the configuration file, see sway-input(5).&lt;br /&gt;
The following environment variables are set by sway:&lt;br /&gt;
&lt;br /&gt;
DISPLAY&lt;br /&gt;
&lt;br /&gt;
If compiled with Xwayland support and Xwayland is not disabled by the config, this will be set to the name of the X display used for Xwayland.&lt;br /&gt;
I3SOCK&lt;br /&gt;
&lt;br /&gt;
For compatibility with i3, specifies the path to the sway IPC socket.&lt;br /&gt;
&lt;br /&gt;
SWAYSOCK&lt;br /&gt;
&lt;br /&gt;
Specifies the path to the sway IPC socket.[https://itcomprehension.com/ipc-ports-services-and-connections-explained]&lt;br /&gt;
&lt;br /&gt;
WAYLAND_DISPLAY&lt;br /&gt;
&lt;br /&gt;
Specifies the name of the Wayland display that sway is running on.&lt;br /&gt;
XCURSOR_SIZE]&lt;br /&gt;
&lt;br /&gt;
Specifies the configured cursor size.&lt;br /&gt;
XCURSOR_THEME&lt;br /&gt;
&lt;br /&gt;
Specifies the configured cursor theme.&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
{{Define|Source|[https://man.archlinux.org/man/sway.1]}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# swaymsg -t get_seats&lt;br /&gt;
&amp;lt;timestamp&amp;gt; [swaymsg/main.c:419] Unable to retrieve socket path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What if &amp;lt;var&amp;gt;/etc/sway/config.d/*&amp;lt;/var&amp;gt; is empty? ===&lt;/div&gt;</summary>
		<author><name>CRBrechin</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23018</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23018"/>
		<updated>2023-02-28T04:08:47Z</updated>

		<summary type="html">&lt;p&gt;CRBrechin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://swaywm.org Sway] is a tiling [[Wayland]] compositor. It&#039;s a drop-in replacement for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget, you will need to add the community repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ whoami&lt;br /&gt;
user&lt;br /&gt;
$ su &lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# echo $USER # just so that we know we retained the same environment variables&lt;br /&gt;
user&lt;br /&gt;
# # if the output is &#039;root&#039; then we know we must have logged in using &#039;su -&#039;&lt;br /&gt;
# cat /etc/apk/repositories&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# # You can edit the files in vi and remove the comment &#039;#&#039; from the line that has &amp;lt;version&amp;gt;/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have updated the file manually you can continue to the [[Installation|installation]] step.&lt;br /&gt;
&lt;br /&gt;
{{Tip| Or you can run something &amp;lt;strong&amp;gt;ridiculous&amp;lt;/strong&amp;gt; like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# tFILE=&#039;/etc/apk/repositories&#039;&lt;br /&gt;
# line=&amp;quot;$(cat $tFILE | grep -E &amp;quot;^#.*alpine/v.*/community&amp;quot; | cut -f1 -d:)&amp;quot; # add the comments so that it doesn&#039;t run everytime&lt;br /&gt;
# awk -v line=$line &#039;FNR == line { sub(&amp;quot;#&amp;quot;,&amp;quot;&amp;quot;); print } FNR != line { print }&#039; $tFILE &amp;gt; $tFILE.upd&lt;br /&gt;
# cat $tFILE.upd # if everything is correct after inspection then we can move it over&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# cp $tFILE $tFILE.bak # just in case the hairbrained idea doesn&#039;t work&lt;br /&gt;
# cat $tFILE.upd &amp;gt; $tFILE; rm $tFILE.upd # we want to keep the file permissions so don&#039;t use cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
eudev:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# rc-update # let&#039;s look at the services that are configured for each run-level&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add eudev&lt;br /&gt;
# setup-devd udev&lt;br /&gt;
# rc-update # we can now see the services that have been added by the setup script&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Graphics drivers:&lt;br /&gt;
&lt;br /&gt;
* [[Intel Video]]&lt;br /&gt;
* [[Radeon Video]]&lt;br /&gt;
* [[Nvidia Video]]&lt;br /&gt;
Add user to the input and video groups:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# echo $USER&lt;br /&gt;
user&lt;br /&gt;
# adduser $USER input&lt;br /&gt;
# adduser $USER video&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install some TTF fonts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add ttf-dejavu&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
seatd daemon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# # if we like we can look at the services again using rc-update&lt;br /&gt;
# apk add seatd&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# rc-update add seatd&lt;br /&gt;
# # and then look again to compare&lt;br /&gt;
# rc-service seatd start&lt;br /&gt;
# adduser $tempUSER seat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install sway:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add sway sway-doc&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add                \ # Install optional dependencies:&lt;br /&gt;
    xwayland             \ # recommended for compatibility reasons&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    bemenu               \ # wayland menu&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # wallpaper daemon&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
For inter-program communication and functionality such as screensharing, install and enable dbus and PipeWire, see [[PipeWire]] and set &amp;lt;code&amp;gt;SWAYSOCK&amp;lt;/code&amp;gt; environmental variable to the value exported by &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt;. In order to ensure that Pipewire and related services inherit the right environment variables, it is recommended to start these services via a process that is a direct descendant of sway itself.&lt;br /&gt;
&lt;br /&gt;
Launch Sway with a D-Bus server available, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dbus-run-session -- sway #prepend with exec in your login shell init script&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
An example config is provided at &amp;lt;code&amp;gt;/etc/sway/config&amp;lt;/code&amp;gt;. Copy it to &amp;lt;code&amp;gt;~/.config/sway/config&amp;lt;/code&amp;gt; and read through it to learn the default keybindings.&lt;br /&gt;
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&#039;t been provided for i3WM.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== Firefox screensharing ===&lt;br /&gt;
&lt;br /&gt;
For some programs, additional configuration is needed to launch them natively under Wayland and to support special features such as screen sharing.&lt;br /&gt;
&lt;br /&gt;
To launch Firefox natively under Wayland and to enable support for screensharing, you need:&lt;br /&gt;
&lt;br /&gt;
* Install and configure [[PipeWire]]&lt;br /&gt;
* Install xdg-desktop-portal and xdg-desktop-portal-wlr package&lt;br /&gt;
* Install wofi for screen selection&lt;br /&gt;
* Launch support programs on sway startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/pipewire-launcher #pipewire must be launched first&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Export the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=&amp;quot;1&amp;quot;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
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-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&#039;s page on the subject]. In addition to the steps under the &amp;quot;Firefox Screensharing&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
After installing different backends, you might need to add the relevant backends to your sway config file similarly to in the &amp;quot;Firefox Screensharing&amp;quot; section above. For example, an autostart section of your sway config file may include:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gnome&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is only needed if they are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
=== Scaling for high resolution screens ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces might be too small to use on high resolution screens.&lt;br /&gt;
&lt;br /&gt;
==== Via sway ====&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g., 1.5x), and&lt;br /&gt;
* integer scaling (e.g., 2x) &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with &amp;lt;code&amp;gt;wdisplays&amp;lt;/code&amp;gt; package.  Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2.  To make changes permanent, add&lt;br /&gt;
&lt;br /&gt;
[[#output|output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;]] to ~/.config/sway/config&lt;br /&gt;
&lt;br /&gt;
==== Via GTK/Qt ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for GTK-based programs such as firefox and emacs:&lt;br /&gt;
export GDK_DPI_SCALE=2&lt;br /&gt;
&lt;br /&gt;
# for QT-based programs&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=&amp;quot;physical&amp;quot;&lt;br /&gt;
# or if still too small, use a custom DPI&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=192 # 2x scaling&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Make clipboard content persistent ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Install clipman from test repo and add the following to sway config:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox picture-in-picture mode/floating windows ===&lt;br /&gt;
Add this to your sway config file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
A simple tool that works well under Wayland is Grimshot. Example keybindings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki&#039;s article] for a list of screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock enabled ===&lt;br /&gt;
Add this to your sway config file:&lt;br /&gt;
&amp;lt;code&amp;gt;input type:keyboard xkb_numlock enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change cursor theme and size ===&lt;br /&gt;
Add to your sway config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your config does not result in change, try logging out and in.&lt;br /&gt;
{{Note|Wayland uses client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Start as a service ===&lt;br /&gt;
Although this is not necessary, you may write an init script like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{/etc/init.d/sway|&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
description=&amp;quot;Sway Compositor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
command=&amp;quot;/usr/bin/sway&amp;quot;&lt;br /&gt;
command_args=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
pidfile=&amp;quot;/run/sway.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--background --pidfile ${pidfile}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
  need localmount&lt;br /&gt;
  after elogind&lt;br /&gt;
  use seatd dbus&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then as a root run &amp;lt;code&amp;gt;chmod +x /etc/init.d/seat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rc-update add sway default&amp;lt;/code&amp;gt;. Make sure you have elogind installed or specify another service, like your display/login manager after which the sway service will run.&lt;br /&gt;
&lt;br /&gt;
=== Custom keyboard layout ===&lt;br /&gt;
&lt;br /&gt;
Since wayland does not support setxkbmap, you will also need to add similar content to your &#039;&#039;/usr/share/X11/xkb/rules/evdev.xml&#039;&#039;, after &amp;lt;code&amp;gt;&amp;lt;/modelList&amp;gt;&amp;lt;/code&amp;gt; and after &amp;lt;code&amp;gt;&amp;lt;layoutList&amp;gt;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
      &amp;lt;configItem&amp;gt;&lt;br /&gt;
        &amp;lt;name&amp;gt;[the name of your layout, same as the name of the file in /usr/share/X11/xkb/symbols]&amp;lt;/name&amp;gt;&lt;br /&gt;
        &amp;lt;shortDescription&amp;gt;[usually just two letters]&amp;lt;/shortDescription&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;[description of your layout]&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;countryList&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;US&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;NO&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
        &amp;lt;/countryList&amp;gt;&lt;br /&gt;
        &amp;lt;languageList&amp;gt;&lt;br /&gt;
          &amp;lt;iso639Id&amp;gt;eng&amp;lt;/iso639Id&amp;gt;&lt;br /&gt;
        &amp;lt;/languageList&amp;gt;&lt;br /&gt;
      &amp;lt;/configItem&amp;gt;&lt;br /&gt;
    &amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;!--[other layouts]--&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, to enable for all keyboards, navigate to the input section of &#039;&#039;~/.config/sway/config&#039;&#039; and modify it to &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input * {&lt;br /&gt;
  xkb_layout &amp;quot;my_layout&amp;quot; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you have enabled &amp;lt;code&amp;gt;xkb_numlock&amp;lt;/code&amp;gt;, include this setting inside those braces as well.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/code&amp;gt;. 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). &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK apps ===&lt;br /&gt;
==== Disappearing cursor ====&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively you can install a theme      for all users (search [https://pkgs.alpinelinux.org/ Alpine Linux Packages] for &#039;&#039;*-icon-theme&#039;&#039;) using &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start ===&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your WLR_BACKENDS environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add libinput here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install libinput first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
=== Sway socket not detected ===&lt;br /&gt;
&lt;br /&gt;
See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[Tmux terminal multiplexer|tmux]]&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
[[Category:Desktop]]&lt;br /&gt;
&lt;br /&gt;
== Novice Questions ==&lt;br /&gt;
&lt;br /&gt;
=== What if the services &amp;lt;var&amp;gt;hwdrivers&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;mdev&amp;lt;/var&amp;gt; are not in the &amp;lt;var&amp;gt;sysinit&amp;lt;/var&amp;gt; run-level? ===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;udev performs its own hwdrivers module detection, it does not need the additional service. We delete the hwdrivers service when enabling udev, and add it when enabling mdev and mdevd.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://gitlab-test.alpinelinux.org/alpine/alpine-conf/-/merge_requests/100 alpine-conf]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What does &amp;lt;var&amp;gt;seatd&amp;lt;/var&amp;gt; do? ===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;Seat management takes care of mediating access to shared devices (graphics, input), without requiring the applications needing access to be root.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://sr.ht/~kennylevinsen/seatd/ sourcehut]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What if I run into a problem with sway? ===&lt;br /&gt;
You can always check the version that you are running. But problems like the following error can occur:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
Error loading shared library libjson-c.so.5: I/O error (needed by /usr/bin/sway)&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When this error occurred I was experiencing trouble with the filesystem. The filesystem had *booped* itself into &amp;lt;var&amp;gt;read-only mode&amp;lt;/var&amp;gt;. A reboot fixed this error.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
sway version 1.7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What happens if &amp;lt;var&amp;gt;SWAYSOCKET&amp;lt;/var&amp;gt; is empty? ===&lt;br /&gt;
=== What happens if &amp;lt;var&amp;gt;LD_LIBRARY_PATH&amp;lt;/var&amp;gt; is empty? ===&lt;br /&gt;
=== What if &amp;lt;var&amp;gt;/etc/sway/config.d/*&amp;lt;/var&amp;gt; is empty? ===&lt;/div&gt;</summary>
		<author><name>CRBrechin</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23017</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23017"/>
		<updated>2023-02-28T02:40:36Z</updated>

		<summary type="html">&lt;p&gt;CRBrechin: Continual editing to flesh out the installation process; format edits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://swaywm.org Sway] is a tiling [[Wayland]] compositor. It&#039;s a drop-in replacement for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget, you will need to add the community repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ whoami&lt;br /&gt;
user&lt;br /&gt;
$ su -&lt;br /&gt;
Password:&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# cat /etc/apk/repositories&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# # You can edit the files in vi and remove the comment &#039;#&#039; from the line that has &amp;lt;verson&amp;gt;/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have updated the file manually you can continue to the [[Installation|installation]] step&lt;br /&gt;
&lt;br /&gt;
{{Tip| Or you can run something *ridiculous* like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# tFILE=&#039;/etc/apk/repositories&#039;&lt;br /&gt;
# line=&amp;quot;$(cat $tFILE | grep -E &amp;quot;^#.*alpine/v.*/community&amp;quot; | cut -f1 -d:)&amp;quot; # add the comments so that it doesn&#039;t run everytime&lt;br /&gt;
# awk -v line=$line &#039;FNR == line { sub(&amp;quot;#&amp;quot;,&amp;quot;&amp;quot;); print } FNR != line { print }&#039; $tFILE &amp;gt; $tFILE.upd&lt;br /&gt;
# cat $tFILE.upd # if everything is correct after inspection then we can move it over&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# cp $tFILE $tFILE.bak # just in case the hairbrained idea doesn&#039;t work&lt;br /&gt;
# cat $tFILE.upd &amp;gt; $tFILE; rm $tFILE.upd # we want to keep the file permissions so don&#039;t use cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
eudev:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# rc-update # let&#039;s look at the services that are configured for each run-level&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add eudev&lt;br /&gt;
# setup-devd udev&lt;br /&gt;
# rc-update # we can now see the services that have been added by the setup script&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== What if the services &amp;lt;var&amp;gt;hwdrivers&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;mdev&amp;lt;/var&amp;gt; are not in the &amp;lt;var&amp;gt;sysinit&amp;lt;/var&amp;gt; run-level? ====&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;udev performs its own hwdrivers module detection, it does not need the additional service. We delete the hwdrivers service when enabling udev, and add it when enabling mdev and mdevd.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://gitlab-test.alpinelinux.org/alpine/alpine-conf/-/merge_requests/100 alpine-conf]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Graphics drivers:&lt;br /&gt;
&lt;br /&gt;
* [[Intel Video]]&lt;br /&gt;
* [[Radeon Video]]&lt;br /&gt;
* [[Nvidia Video]]&lt;br /&gt;
Add user to the input and video groups:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# tmpUSER=&#039;&amp;lt;user&amp;gt;&#039; # setting the tmpUSER variable instead of overriding an environment variable&lt;br /&gt;
# echo &amp;quot;Username set: $tmpUSER&amp;quot; # remember to replace &amp;lt;user&amp;gt; for the username that you have set on your machine&lt;br /&gt;
Username set: user&lt;br /&gt;
# adduser $tmpUSER input&lt;br /&gt;
# adduser $empUSER video&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install some TTF fonts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add ttf-dejavu&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
seatd daemon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# # if we like we can look at the services again using rc-update&lt;br /&gt;
# apk add seatd&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# rc-update add seatd&lt;br /&gt;
# # and then look again to compare&lt;br /&gt;
# rc-service seatd start&lt;br /&gt;
# adduser $tempUSER seat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== What does &amp;lt;var&amp;gt;seatd&amp;lt;/var&amp;gt; do? ====&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;Seat management takes care of mediating access to shared devices (graphics, input), without requiring the applications needing access to be root.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://sr.ht/~kennylevinsen/seatd/ sourcehut]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install sway:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add sway sway-doc&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add                \ # Install optional dependencies:&lt;br /&gt;
    xwayland             \ # recommended for compatibility reasons&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    bemenu               \ # wayland menu&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # wallpaper daemon&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== What if I run into a problem with sway? ====&lt;br /&gt;
You can always check the version that you are running&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
Error loading shared library libjson-c.so.5: I/O error (needed by /usr/bin/sway)&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When this error occurred I was experiencing trouble with the filesystem. The filesystem had *booped* itself into &amp;lt;var&amp;gt;read-only mode&amp;lt;/var&amp;gt;. A reboot fixed this error.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
sway version 1.7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
For inter-program communication and functionality such as screensharing, install and enable dbus and PipeWire, see [[PipeWire]] and set &amp;lt;code&amp;gt;SWAYSOCK&amp;lt;/code&amp;gt; environmental variable to the value exported by &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt;. In order to ensure that Pipewire and related services inherit the right environment variables, it is recommended to start these services via a process that is a direct descendant of sway itself.&lt;br /&gt;
&lt;br /&gt;
Launch Sway with a D-Bus server available, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dbus-run-session -- sway #prepend with exec in your login shell init script&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
An example config is provided at &amp;lt;code&amp;gt;/etc/sway/config&amp;lt;/code&amp;gt;. Copy it to &amp;lt;code&amp;gt;~/.config/sway/config&amp;lt;/code&amp;gt; and read through it to learn the default keybindings.&lt;br /&gt;
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&#039;t been provided for i3WM.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== Firefox screensharing ===&lt;br /&gt;
&lt;br /&gt;
For some programs, additional configuration is needed to launch them natively under Wayland and to support special features such as screen sharing.&lt;br /&gt;
&lt;br /&gt;
To launch Firefox natively under Wayland and to enable support for screensharing, you need:&lt;br /&gt;
&lt;br /&gt;
* Install and configure [[PipeWire]]&lt;br /&gt;
* Install xdg-desktop-portal and xdg-desktop-portal-wlr package&lt;br /&gt;
* Install wofi for screen selection&lt;br /&gt;
* Launch support programs on sway startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/pipewire-launcher #pipewire must be launched first&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Export the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=&amp;quot;1&amp;quot;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
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-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&#039;s page on the subject]. In addition to the steps under the &amp;quot;Firefox Screensharing&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
After installing different backends, you might need to add the relevant backends to your sway config file similarly to in the &amp;quot;Firefox Screensharing&amp;quot; section above. For example, an autostart section of your sway config file may include:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gnome&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is only needed if they are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
=== Scaling for high resolution screens ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces might be too small to use on high resolution screens.&lt;br /&gt;
&lt;br /&gt;
==== Via sway ====&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g., 1.5x), and&lt;br /&gt;
* integer scaling (e.g., 2x) &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with &amp;lt;code&amp;gt;wdisplays&amp;lt;/code&amp;gt; package.  Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2.  To make changes permanent, add&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to ~/.config/sway/config.&lt;br /&gt;
&lt;br /&gt;
==== Via GTK/Qt ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for GTK-based programs such as firefox and emacs:&lt;br /&gt;
export GDK_DPI_SCALE=2&lt;br /&gt;
&lt;br /&gt;
# for QT-based programs&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=&amp;quot;physical&amp;quot;&lt;br /&gt;
# or if still too small, use a custom DPI&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=192 # 2x scaling&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Make clipboard content persistent ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Install clipman from test repo and add the following to sway config:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox picture-in-picture mode/floating windows ===&lt;br /&gt;
Add this to your sway config file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
A simple tool that works well under Wayland is Grimshot. Example keybindings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki&#039;s article] for a list of screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock enabled ===&lt;br /&gt;
Add this to your sway config file:&lt;br /&gt;
&amp;lt;code&amp;gt;input type:keyboard xkb_numlock enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change cursor theme and size ===&lt;br /&gt;
Add to your sway config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your config does not result in change, try logging out and in.&lt;br /&gt;
{{Note|Wayland uses client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Start as a service ===&lt;br /&gt;
Although this is not necessary, you may write an init script like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{/etc/init.d/sway|&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
description=&amp;quot;Sway Compositor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
command=&amp;quot;/usr/bin/sway&amp;quot;&lt;br /&gt;
command_args=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
pidfile=&amp;quot;/run/sway.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--background --pidfile ${pidfile}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
  need localmount&lt;br /&gt;
  after elogind&lt;br /&gt;
  use seatd dbus&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then as a root run &amp;lt;code&amp;gt;chmod +x /etc/init.d/seat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rc-update add sway default&amp;lt;/code&amp;gt;. Make sure you have elogind installed or specify another service, like your display/login manager after which the sway service will run.&lt;br /&gt;
&lt;br /&gt;
=== Custom keyboard layout ===&lt;br /&gt;
&lt;br /&gt;
Since wayland does not support setxkbmap, you will also need to add similar content to your &#039;&#039;/usr/share/X11/xkb/rules/evdev.xml&#039;&#039;, after &amp;lt;code&amp;gt;&amp;lt;/modelList&amp;gt;&amp;lt;/code&amp;gt; and after &amp;lt;code&amp;gt;&amp;lt;layoutList&amp;gt;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
      &amp;lt;configItem&amp;gt;&lt;br /&gt;
        &amp;lt;name&amp;gt;[the name of your layout, same as the name of the file in /usr/share/X11/xkb/symbols]&amp;lt;/name&amp;gt;&lt;br /&gt;
        &amp;lt;shortDescription&amp;gt;[usually just two letters]&amp;lt;/shortDescription&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;[description of your layout]&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;countryList&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;US&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;NO&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
        &amp;lt;/countryList&amp;gt;&lt;br /&gt;
        &amp;lt;languageList&amp;gt;&lt;br /&gt;
          &amp;lt;iso639Id&amp;gt;eng&amp;lt;/iso639Id&amp;gt;&lt;br /&gt;
        &amp;lt;/languageList&amp;gt;&lt;br /&gt;
      &amp;lt;/configItem&amp;gt;&lt;br /&gt;
    &amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;!--[other layouts]--&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, to enable for all keyboards, navigate to the input section of &#039;&#039;~/.config/sway/config&#039;&#039; and modify it to &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input * {&lt;br /&gt;
  xkb_layout &amp;quot;my_layout&amp;quot; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you have enabled &amp;lt;code&amp;gt;xkb_numlock&amp;lt;/code&amp;gt;, include this setting inside those braces as well.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/code&amp;gt;. 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). &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK apps ===&lt;br /&gt;
==== Disappearing cursor ====&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively you can install a theme      for all users (search [https://pkgs.alpinelinux.org/ Alpine Linux Packages] for &#039;&#039;*-icon-theme&#039;&#039;) using &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start ===&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your WLR_BACKENDS environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add libinput here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install libinput first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
=== Sway socket not detected ===&lt;br /&gt;
&lt;br /&gt;
See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[Tmux terminal multiplexer|tmux]]&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
[[Category:Desktop]]&lt;/div&gt;</summary>
		<author><name>CRBrechin</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23015</id>
		<title>Sway</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sway&amp;diff=23015"/>
		<updated>2023-02-27T07:01:54Z</updated>

		<summary type="html">&lt;p&gt;CRBrechin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://swaywm.org Sway] is a tiling [[Wayland]] compositor. It&#039;s a drop-in replacement for the i3 window manager.&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget, you will need to add the community repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ whoami&lt;br /&gt;
user&lt;br /&gt;
$ su -&lt;br /&gt;
Password:&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# cat /etc/apk/repositories&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# # You can edit the files in vi and remove the comment &#039;#&#039; from the line that has &amp;lt;verson&amp;gt;/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have updated the file manually you can continue to the [[Installation|installation]] step&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#r you can run something *ridiculous* like this:&lt;br /&gt;
# tFILE=&#039;/etc/apk/repositories&#039;&lt;br /&gt;
# line=&amp;quot;$(cat $tFILE | grep -E &amp;quot;^#.*alpine/v.*/community&amp;quot; | cut -f1 -d:)&amp;quot; # add the comments so that it doesn&#039;t run everytime&lt;br /&gt;
# awk -v line=$line &#039;FNR == line { sub(&amp;quot;#&amp;quot;,&amp;quot;&amp;quot;); print } FNR != line { print }&#039; $tFILE &amp;gt; $tFILE.upd&lt;br /&gt;
# cat $tFILE.upd # if everything is correct after inspection then we can move it over&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# cp $tFILE $tFILE.bak # just in case the hairbrained idea doesn&#039;t work&lt;br /&gt;
# cat $tFILE.upd &amp;gt; $tFILE; rm $tFILE.upd # we want to keep the file permissions so don&#039;t use cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
eudev:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# whoami&lt;br /&gt;
root&lt;br /&gt;
# rc-update # let&#039;s look at the services that are configured for each run-level&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add eudev&lt;br /&gt;
# setup-devd udev&lt;br /&gt;
# rc-update # we can now see the services that have been added by the setup script&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== What if the services &amp;lt;var&amp;gt;hwdrivers&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;mdev&amp;lt;/var&amp;gt; are not in the &amp;lt;var&amp;gt;sysinit&amp;lt;/var&amp;gt; run-level? ====&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;udev performs its own hwdrivers module detection, it does not need the additional service. We delete the hwdrivers service when enabling udev, and add it when enabling mdev and mdevd.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://gitlab-test.alpinelinux.org/alpine/alpine-conf/-/merge_requests/100 alpine-conf]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Graphics drivers:&lt;br /&gt;
&lt;br /&gt;
* [[Intel Video]]&lt;br /&gt;
* [[Radeon Video]]&lt;br /&gt;
* [[Nvidia Video]]&lt;br /&gt;
Add user to the input and video groups:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# tmpUSER=&#039;&amp;lt;user&amp;gt;&#039; # setting the tmpUSER variable instead of overriding an environment variable&lt;br /&gt;
# echo &amp;quot;Username set: $tmpUSER&amp;quot; # remember to replace &amp;lt;user&amp;gt; for the username that you have set on your machine&lt;br /&gt;
Username set: user&lt;br /&gt;
# adduser $tmpUSER input&lt;br /&gt;
# adduser $empUSER video&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install some TTF fonts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add ttf-dejavu&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
seatd daemon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# # if we like we can look at the services again using rc-update&lt;br /&gt;
# apk add seatd&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# rc-update add seatd&lt;br /&gt;
# # and then look again to compare&lt;br /&gt;
# rc-service seatd start&lt;br /&gt;
# adduser $tempUSER seat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== What does &amp;lt;var&amp;gt;seatd&amp;lt;/var&amp;gt; do? ====&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;Seat management takes care of mediating access to shared devices (graphics, input), without requiring the applications needing access to be root.&amp;quot;&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;Source: &amp;lt;/strong&amp;gt;[https://sr.ht/~kennylevinsen/seatd/ sourcehut]&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install sway:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add sway sway-doc&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
# apk add                \ # Install optional dependencies:&lt;br /&gt;
    xwayland             \ # recommended for compatibility reasons&lt;br /&gt;
    foot                 \ # default terminal emulator. Modify $term in config for a different one.&lt;br /&gt;
    bemenu               \ # wayland menu&lt;br /&gt;
    swaylock swaylockd   \ # lockscreen tool&lt;br /&gt;
    swaybg               \ # wallpaper daemon&lt;br /&gt;
    swayidle               # idle management (DPMS) daemon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== What if I run into a problem with sway? ====&lt;br /&gt;
You can always check the version that you are running&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
Error loading shared library libjson-c.so.5: I/O error (needed by /usr/bin/sway)&lt;br /&gt;
&amp;lt;snippet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When this error occurred I was experiencing trouble with the filesystem. The filesystem had *booped* itself into &amp;lt;var&amp;gt;read-only mode&amp;lt;/var&amp;gt;. A reboot fixed this error.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sway --version&lt;br /&gt;
sway version 1.7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure [[Wayland#XDG_RUNTIME_DIR|XDG_RUNTIME_DIR]].&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
For inter-program communication and functionality such as screensharing, install and enable dbus and PipeWire, see [[PipeWire]] and set &amp;lt;code&amp;gt;SWAYSOCK&amp;lt;/code&amp;gt; environmental variable to the value exported by &amp;lt;code&amp;gt;sway&amp;lt;/code&amp;gt;. In order to ensure that Pipewire and related services inherit the right environment variables, it is recommended to start these services via a process that is a direct descendant of sway itself.&lt;br /&gt;
&lt;br /&gt;
Launch Sway with a D-Bus server available, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dbus-run-session -- sway #prepend with exec in your login shell init script&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
An example config is provided at &amp;lt;code&amp;gt;/etc/sway/config&amp;lt;/code&amp;gt;. Copy it to &amp;lt;code&amp;gt;~/.config/sway/config&amp;lt;/code&amp;gt; and read through it to learn the default keybindings.&lt;br /&gt;
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&#039;t been provided for i3WM.&lt;br /&gt;
&lt;br /&gt;
For additional information, start at &amp;lt;code&amp;gt;man 5 sway&amp;lt;/code&amp;gt; and read the [https://github.com/swaywm/sway/wiki upstream wiki].&lt;br /&gt;
&lt;br /&gt;
=== Firefox screensharing ===&lt;br /&gt;
&lt;br /&gt;
For some programs, additional configuration is needed to launch them natively under Wayland and to support special features such as screen sharing.&lt;br /&gt;
&lt;br /&gt;
To launch Firefox natively under Wayland and to enable support for screensharing, you need:&lt;br /&gt;
&lt;br /&gt;
* Install and configure [[PipeWire]]&lt;br /&gt;
* Install xdg-desktop-portal and xdg-desktop-portal-wlr package&lt;br /&gt;
* Install wofi for screen selection&lt;br /&gt;
* Launch support programs on sway startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/pipewire-launcher #pipewire must be launched first&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Export the following variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MOZ_ENABLE_WAYLAND=&amp;quot;1&amp;quot;&lt;br /&gt;
export XDG_CURRENT_DESKTOP=sway&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flatpaks ===&lt;br /&gt;
&lt;br /&gt;
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-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&#039;s page on the subject]. In addition to the steps under the &amp;quot;Firefox Screensharing&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
After installing different backends, you might need to add the relevant backends to your sway config file similarly to in the &amp;quot;Firefox Screensharing&amp;quot; section above. For example, an autostart section of your sway config file may include:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gtk&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-wlr&lt;br /&gt;
exec /usr/libexec/xdg-desktop-portal-gnome&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is only needed if they are not started automatically via other means.&lt;br /&gt;
&lt;br /&gt;
=== Scaling for high resolution screens ===&lt;br /&gt;
&lt;br /&gt;
Without further configuration, program interfaces might be too small to use on high resolution screens.&lt;br /&gt;
&lt;br /&gt;
==== Via sway ====&lt;br /&gt;
&lt;br /&gt;
Sway supports the per-display configuration of&lt;br /&gt;
&lt;br /&gt;
* fractional (e.g., 1.5x), and&lt;br /&gt;
* integer scaling (e.g., 2x) &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
To enable Sway scaling, the user can first preview different scaling factors with &amp;lt;code&amp;gt;wdisplays&amp;lt;/code&amp;gt; package.  Note the output name (eDP-1, LVDS-1) and try apply scaling factors such as 1 and 2.  To make changes permanent, add&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
output &amp;lt;name&amp;gt; scale &amp;lt;factor&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to ~/.config/sway/config.&lt;br /&gt;
&lt;br /&gt;
==== Via GTK/Qt ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for GTK-based programs such as firefox and emacs:&lt;br /&gt;
export GDK_DPI_SCALE=2&lt;br /&gt;
&lt;br /&gt;
# for QT-based programs&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=&amp;quot;physical&amp;quot;&lt;br /&gt;
# or if still too small, use a custom DPI&lt;br /&gt;
export QT_WAYLAND_FORCE_DPI=192 # 2x scaling&lt;br /&gt;
export QT_QPA_PLATFORM=&amp;quot;wayland-egl&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Make clipboard content persistent ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Install clipman from test repo and add the following to sway config:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
exec wl-paste --type text/plain --watch clipman store --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
bindsym $mod+h exec clipman pick --tool wofi --histpath=&amp;quot;~/.local/state/clipman-primary.json&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firefox picture-in-picture mode/floating windows ===&lt;br /&gt;
Add this to your sway config file (modify the numeric values to suit your needs and your display):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for_window [app_id=&amp;quot;firefox&amp;quot; title=&amp;quot;^Picture-in-Picture$&amp;quot;] floating enable, move position 877 450, sticky enable, border none&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Screenshots ===&lt;br /&gt;
A simple tool that works well under Wayland is Grimshot. Example keybindings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bindsym Print exec grimshot copy area&lt;br /&gt;
bindsym Shift+Print exec grimshot copy screen&lt;br /&gt;
bindsym Control+Print exec grimshot save area ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
bindsym Control+Shift+Print exec grimshot save screen ~/Pictures/$(date +%d-%m-%Y-%H-%M-%S).png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway the sway wiki&#039;s article] for a list of screenshot tools.&lt;br /&gt;
&lt;br /&gt;
=== Start with NumLock enabled ===&lt;br /&gt;
Add this to your sway config file:&lt;br /&gt;
&amp;lt;code&amp;gt;input type:keyboard xkb_numlock enabled&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change cursor theme and size ===&lt;br /&gt;
Add to your sway config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
seat seat0 xcursor_theme my_cursor_theme my_cursor_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can inspect their values with &amp;lt;code&amp;gt;echo $XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;echo $XCURSOR_THEME&amp;lt;/code&amp;gt;. If reloading your config does not result in change, try logging out and in.&lt;br /&gt;
{{Note|Wayland uses client-side cursors. It is possible that applications do not evaluate the values of &amp;lt;code&amp;gt;$XCURSOR_SIZE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;$XCURSOR_THEME&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
=== Start as a service ===&lt;br /&gt;
Although this is not necessary, you may write an init script like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{/etc/init.d/sway|&lt;br /&gt;
#!/sbin/openrc-run&lt;br /&gt;
&lt;br /&gt;
description=&amp;quot;Sway Compositor&amp;quot;&lt;br /&gt;
&lt;br /&gt;
command=&amp;quot;/usr/bin/sway&amp;quot;&lt;br /&gt;
command_args=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
pidfile=&amp;quot;/run/sway.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
start_stop_daemon_args=&amp;quot;--background --pidfile ${pidfile}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
  need localmount&lt;br /&gt;
  after elogind&lt;br /&gt;
  use seatd dbus&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then as a root run &amp;lt;code&amp;gt;chmod +x /etc/init.d/seat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rc-update add sway default&amp;lt;/code&amp;gt;. Make sure you have elogind installed or specify another service, like your display/login manager after which the sway service will run.&lt;br /&gt;
&lt;br /&gt;
=== Custom keyboard layout ===&lt;br /&gt;
&lt;br /&gt;
Since wayland does not support setxkbmap, you will also need to add similar content to your &#039;&#039;/usr/share/X11/xkb/rules/evdev.xml&#039;&#039;, after &amp;lt;code&amp;gt;&amp;lt;/modelList&amp;gt;&amp;lt;/code&amp;gt; and after &amp;lt;code&amp;gt;&amp;lt;layoutList&amp;gt;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;layout&amp;gt;&lt;br /&gt;
      &amp;lt;configItem&amp;gt;&lt;br /&gt;
        &amp;lt;name&amp;gt;[the name of your layout, same as the name of the file in /usr/share/X11/xkb/symbols]&amp;lt;/name&amp;gt;&lt;br /&gt;
        &amp;lt;shortDescription&amp;gt;[usually just two letters]&amp;lt;/shortDescription&amp;gt;&lt;br /&gt;
        &amp;lt;description&amp;gt;[description of your layout]&amp;lt;/description&amp;gt;&lt;br /&gt;
        &amp;lt;countryList&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;US&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
          &amp;lt;iso3166Id&amp;gt;NO&amp;lt;/iso3166Id&amp;gt;&lt;br /&gt;
        &amp;lt;/countryList&amp;gt;&lt;br /&gt;
        &amp;lt;languageList&amp;gt;&lt;br /&gt;
          &amp;lt;iso639Id&amp;gt;eng&amp;lt;/iso639Id&amp;gt;&lt;br /&gt;
        &amp;lt;/languageList&amp;gt;&lt;br /&gt;
      &amp;lt;/configItem&amp;gt;&lt;br /&gt;
    &amp;lt;/layout&amp;gt;&lt;br /&gt;
&amp;lt;!--[other layouts]--&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, to enable for all keyboards, navigate to the input section of &#039;&#039;~/.config/sway/config&#039;&#039; and modify it to &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input * {&lt;br /&gt;
  xkb_layout &amp;quot;my_layout&amp;quot; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you have enabled &amp;lt;code&amp;gt;xkb_numlock&amp;lt;/code&amp;gt;, include this setting inside those braces as well.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If you encounter any issues, try running &amp;lt;code&amp;gt;sway -Vc /etc/sway/config&amp;lt;/code&amp;gt;. 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). &lt;br /&gt;
&lt;br /&gt;
=== Firefox (Flatpak) and/or GTK apps ===&lt;br /&gt;
==== Disappearing cursor ====&lt;br /&gt;
You may need to get an icon pack and possibly a theme from [https://www.pling.com/browse?cat=107&amp;amp;ord=latest Pling store] and set &amp;lt;code&amp;gt;GTK_THEME&amp;lt;/code&amp;gt; environmental variable. Alternatively you can install a theme      for all users (search [https://pkgs.alpinelinux.org/ Alpine Linux Packages] for &#039;&#039;*-icon-theme&#039;&#039;) using &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Missing file picker/cannot download ====&lt;br /&gt;
&lt;br /&gt;
Go to &#039;&#039;about:config&#039;&#039; and set &amp;lt;code&amp;gt;widget.use-xdg-desktop-portal.file-picker&amp;lt;/code&amp;gt; to 0.&lt;br /&gt;
&lt;br /&gt;
=== Failing to start under certain graphics cards/multiple wlroots stacked windows spawning upon start ===&lt;br /&gt;
As of Dec 31 2022, [https://developer.nvidia.com/docs/drive/drive-os/latest/linux/sdk/common/topics/window_system_stub/Gnome-WaylandDesktopShellSupport136.html Nvidia still doesn&#039;t fully support Wayland]. Therefore, the possible solutions are as outlined in the link, or setting your WLR_BACKENDS environmental variables to &amp;lt;code&amp;gt;drm,libinput&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;x11&amp;lt;/code&amp;gt; (add libinput here as well if you cannot use your mouse and keyboard after starting Sway). The latter also works for AMD/ATI cards (&#039;&#039;&#039;make sure to install libinput first&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
=== Sway socket not detected ===&lt;br /&gt;
&lt;br /&gt;
See [[Sway#Installation|Installation]] for instructions on how to set this environmental variable. This issue may occur with terminal multiplexers, such as [[Tmux terminal multiplexer|tmux]]&lt;br /&gt;
&lt;br /&gt;
=== Steam games launched via Proton crash before creating a window ===&lt;br /&gt;
&lt;br /&gt;
Instead of just using the in-Steam menu to install and select a Proton version, try installing the flatpak community build for Proton onto your system. There are several versions, depending on your desired stability, and the experimental version available in Flathub is called &amp;quot;com.valvesoftware.Steam.CompatibilityTool.Proton-Exp&amp;quot;. After you install your chosen version, go into Steam to specify compatibility tool for a game as usual. The installed community build will now be an option. Select that and try launching the game again.&lt;br /&gt;
[[Category:Desktop]]&lt;/div&gt;</summary>
		<author><name>CRBrechin</name></author>
	</entry>
</feed>