sway is a tiling window manager, active project, working on Wayland. Modelled after i3 which runs on Xorg. Sway was just the right thing for me coming from Window Maker, which seems to stay on Xorg forever. Phoronix sees gnome/Wayland consuming less power than gnome/Xorg.
# I do a LXDE-desktop or minimal installation # of Fedora, and then: dnf -y install sway sddm for i in lxdm kdm gdm lightdm xdm; do systemctl disable $i done systemctl enable sddm systemctl set-default graphical.target reboot # After this, sddm starts and allows to directly run sway
After you got sway running, it's time to familiarize yourself with the keyboard shortcuts and modify the configuration. The default config can be seen at https://github.com/swaywm/sway/blob/master/config.in or in file /etc/sway/config . The config file teaches you all shortcuts you need at this moment.
On my thinkpad, the english keyboard layout was configured by default. The $mod-key is the windows-key, which is on Linux not used anyway. Sway uses that key heavily. For the start, you should use the config suggested by Sway, and can then adapt it to your needs.
The default config is /etc/sway/config. If you want to customize, do this:
mkdir -p ~/.config/sway cp /etc/sway/config ~/.config/sway vi ~/.config/sway/config
Terminals are started in pressing $mod + <return>. Currently I use mostly 'alacritty' and sometimes 'kitty'. Status of various terminals on Fedora, with sway and for my needs:
My terminal config:
$ grep term ~/.config/sway/config set $term /home/chris/bin/myterm.sh $ cat /home/chris/bin/myterm.sh xterm -en UTF-8 -fg white -bg black -fn \ -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1 +sb -e bash
A workspace in Sway is what I called “virtual screen” in Window Maker. Regarding workspaces, I mostly go with the default config from Sway. I just added this: Ctrl+Left changes to the previous workspace, and Ctrl+Right to the next workspace. By default, one can with $mod+1 jump to the first workspace, with $mod+2 to the second workspace, and so on. So I added this in ~/.config/sway/config:
bindsym Ctrl+Left workspace prev # on default keyboards bindsym Ctrl+Right workspace next bindsym Prior workspace prev # Thinkpad keys above cursor keys bindsym Next workspace next bindsym Hangul_Hanja+Left workspace prev # on the keyboard from Korea bindsym Hangul_Hanja+Right workspace next
The last 2 lines utilize a certain key on this keyboard here which I bought in Korea. When running 'xev' and then pressing the key, one sees the identifier for the key, in my case 'Hangul_Hanja'. Typically, this key is used to switch input methods between for example English/Hangul.
I have a habit of locking the screen when leaving the workplace, by pressing F9. Easy to implement:
# install xlock dnf -y install xlockmore # add the config echo 'bindsym F9 exec /usr/bin/xlock -mode blank' >>~/.config/sway/config # reload config press <modkey> + <Shift> + <c> press F9 for testing
On laptops, package `light` should be installed, and this be added to ~/.config/sway/config:
bindsym $mod+Shift+o exec light -U 5 bindsym $mod+Shift+p exec light -A 5
With this, one can press <mod>+<Shift>+<o/p> to control brightness.
Using xrandr is not recommended, wlr-randr should be used instead. I frequently dock/undock my system, and use the following key binding to toggle the internal screen on/off.
# lets look at the names for our outputs swaymsg -t get_outputs Output DP-4 'Dell Inc. DELL U2412M RPT5T2372ADL' (focused) Current mode: 1920x1200 @ 59.950001 Hz [..] Output eDP-1 'Unknown 0x21ED 0x00000000' [..] # Entry in ~/.config/sway/config bindsym $mod+t output "eDP-1" toggle
Alternatively, the internal screen can be activated/deacrivated in ~/.config/sway/config:
# Internal display disabled: output DP-4 enable output eDP-1 disable # Internal display enabled: output DP-4 enable output eDP-1 enable
Using the following status bar with network down/up, volume, cpu load, used memory, fan, battery, weather, time/germany and time/Japan.
dnf install -y python3-psutil python3-netifaces fontawesome-fonts \ git-core python3-requests python3-pytz python3-tzlocal \ lm_sensors cd /opt git clone https://github.com/tobi-wan-kenobi/bumblebee-status # now modify the users ~/.config/sway/config, change status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done into status_command /opt/bumblebee-status/bumblebee-status \ -m traffic pipewire cpu memory sensors2 battery weather datetimetz time \ -p cpu.format={:.00f}% \ traffic.exclude=virbr,lo,redhat,nebula traffic.showname=False \ traffic.format={:.0f} \ time.format="日本 %H:%M" \ datetimetz.format="独 %H:%M" datetimetz.timezone="Europe/Berlin" \ memory.format="{used}" \ sensors2.showtemp=false sensors2.showcpu=false sensors2.field_exclude=fan2 \ traffic.interval=5s cpu.interval=5s sensors2.interval=5s \ memory.interval=1m weather.interval=30m battery.interval=1m \ -t powerline
Details: https://github.com/tobi-wan-kenobi/bumblebee-status .
For the Macbook pro M2 with Fedora Asahi remix I use 'battery-upower' instead of 'battery', and 'shell' to count new mails:
status_command /opt/bumblebee-status/bumblebee-status \ -m traffic pipewire cpu memory sensors2 battery-upower shell weather datetimetz time \ -p cpu.format={:.00f}% \ traffic.exclude=virbr,lo,redhat,nebula traffic.showname=False traffic.format={:.0f} \ time.format="日本 %H:%M" \ datetimetz.format="独 %H:%M" datetimetz.timezone="Europe/Berlin" \ memory.format="{used}" \ sensors2.showtemp=false sensors2.showcpu=false sensors2.field_exclude=fan2 \ traffic.interval=5s cpu.interval=5s sensors2.interval=5s \ memory.interval=1m weather.interval=30m battery.interval=1m \ shell.command="echo -n '📨 '; ls -1 /home/chris/Maildir/new/|wc -l" shell.interval=60 \ -t powerline
Until Fedora37/ibus-1.5.27, ibus did not work for me on sway/wayland. From Fedora37 on the issue is solved.
dnf -y install ibus ibus-setup ibus-gtk3 ibus-wayland \ ibus-skk ibus-mozc ibus-kkc ibus-qt # run ibus-daemon at sway startup echo 'exec /usr/bin/ibus-daemon --xim --daemonize' \ >>~/.config/sway/config # set environment variables, i.e. in ~/.bashrc export IMSETTINGS_INTEGRATE_DESKTOP=yes export IMSETTINGS_MODULE=ibus export QT_IM_MODULE=ibus export XMODIFIERS=@im=ibus export GTK_IM_MODULE=ibus # then exit sway with <modkey>+<Shift>+<e> # and start sway again, then ibus-setup
At the moment I use Fcitx5, not ibus.
dnf -y install fcitx5-configtool fcitx5-kkc fcitx5-mozc # run fcitx at sway startup echo 'exec --no-startup-id fcitx5 -d' >>~/.config/sway/config # set environment variables, i.e. in ~/.bashrc export IMSETTINGS_INTEGRATE_DESKTOP=yes export IMSETTINGS_MODULE=fcitx export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx # then exit sway with <modkey>+<Shift>+<e> # and start sway again, then imsettings-switch fcitx5 fcitx5-configtool
# As of Fedora37, grim is packaged. # If not packaged on your distro, build from https://github.com/emersion/grim dnf install grim # lets take a screenshot grim screenshot.png # if error "failed to create display" env WAYLAND_DISPLAY='wayland-1' grim screenshot.png # After issuing the command, I usually want s few seconds delay to # change to the virtual screen I want to screenshot, so I use this: alias takepic='export WAYLAND_DISPLAY=wayland-1; sleep 3; grim' takepic screenshot.png
As of Fedora35, xdg-desktop-portal-wlr seems like the best way for screen sharing - but it requires to use a browser based videoconf software, does not work with the stand alone Skype program.
Note: Google chrome and chromium in version 112 can not share screen via xdg-desktop-portal-wlr-0.6.0, see here. Downgrade to 111 is required.
sudo dnf -y install xdg-desktop-portal-wlr # add the following to ~/.config/sway/config exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway # then reload sway with <mod-key>+<shift>+<c>
Then access this URL, and click “screen capture” to test.
From video: openSUSEway_is_a_full_Wayland_DE_based_on_Sway, this is recording the screen activity and making it available on a video device like /dev/video0. You can then feed that into Jitsi/bluejeans/skype. This workaround will transmit your normal desktop, but the constant recording causes quite some cpu load.
# install packages dnf install v4l2loopback wf-recorder wlr-randr \ akmod-v4l2loopback kmod-v4l2loopback # ensure module is loaded modprobe v4l2loopback # Note: on Asahi-Fedora-remix I had to manually build # the module: # sudo dnf install kernel-16k-devel # git clone https://github.com/umlaeute/v4l2loopback # cd v4l2loopback && make && sudo make install # sudo modprobe v4l2loopback # find out which device loopback uses, for next command v4l2-ctl --list-devices # start recording screen, using v4l2 loopback device wf-recorder --muxer=v4l2 --codec=rawvideo \ --file=/dev/video0 --pixel-format yuyv422 wlr-randr mplayer tv:// -tv driver=v4l2:device=/dev/video0
webtops container. This runs a desktop in a container, and you can access that desktop in a browser tab, which you can for example share in google meet. This uses memory, but less cpu load than “way 2”.
podman run -d --name=webtop \ -e PUID=1000 -e PGID=1000 -e TZ=Asia/Tokyo -p 3000:3000 \ -v /home/chris/sync:/sync:Z,ro --shm-size="1gb" \ --restart unless-stopped ghcr.io/linuxserver/webtop:fedora-xfce
Then access the container destop via http://localhost:3000/ .
I've hit some applications doing particularly bad under sway/wayland.
WAYLAND_DISPLAY= alacritty
WINIT_UNIX_BACKEND=x11 alacritty