todo.md 8.8 KB

todo

Transitioning to Sway/Wayland for desktop environment.

Expect iterative changes over the following months while fine-tuning happens on real hardware.

sway

Create a sway branch to test building a minimal install with a brand new window manager and removing xorg packages!

Disable all GUI packages to build a "minimal" install.

We'll take that image and triple check package dependency chains for sway and applications to run on it

This will likely require significant refinement, as I'll need to test configurations on real hardware to validate multi-monitor behavior.

Further, it will require some time to get used to it, but from rudimentary tests I have been able to run every game of interest on it, and with significantly increased performance!

References:

https://www.fosskers.ca/en/blog/wayland https://wiki.archlinux.org/title/Sway#Manage_Sway-specific_daemons_with_systemd https://wiki.archlinux.org/title/Sway#Application_launchers https://github.com/swaywm/sway/issues/1174 https://www.youtube.com/watch?v=hRIGYUWQfYU https://www.youtube.com/watch?v=YWgZrES4t3U https://github.com/swaywm/sway/wiki#program-launchers https://github.com/lyfeyaj/sublime-text-imfix https://www.reddit.com/r/swaywm/comments/eksf1p/steam_now_fully_works_under_sway/

Installed packages:

sway
alacritty
wofi
waybar
xorg-xwayland
xorg-xlsclients
qt5-wayland
glfw-wayland
grim
slurp
xdg-desktop-portal-wlr
libpipewire02
ttf-font-awesome
wl-clipboard
lxsession-gtk3

Next create a config for sway:

mkdir -p ~/.config/sway
cp /etc/sway/config ~/.config/sway/config

I'm still tinkering with one using wofi for $menu and waybar, but it's not nearly ready.

Migrate as many hotkeys from rc.xml as possible to sway config

Added to ~/.bash_profile:

export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER="wayland"

The SDL_VIDEODRIVER is for steam, and may break in many games, so I'll need to add overrides for incompatible titles using SDL_VIDEODRIVER=x11 in steam launch commands, or if more games fail than no I can invert my setup so I add the override for games that I know work with wayland.

Switch to waybar in sway config (this is a massive improvement over the default):

bar {
    swaybar_command waybar
}

I need to research how to fully customize waybar, because it has a lot of data and could be refined!

I need to test wayland native alternatives to urxvt and pcmanfm; one recommendation is alacritty as a urxvt replacement, and pcmanfm-gtk3 is supposedly wayland-compatible without xwayland. Needs to be tested.

I also need to test a base install with no GUI packages and manually installing the sway dependencies to ensure a minimal build.

Add logic to sway config that starts sway-session target:

exec_always "systemctl --user import-environment; systemctl --user start sway-session.target"

Delete legacy userspace service files, and edit/change others for sway-session compatibility.

Create new systemd service files for:

  • update-desktop-database (oneshot)
  • xdg-user-dirs-update (oneshot)
  • gtk3-settings (oneshot)

Verify whether we can delete .Xdefaults and .Xresources, as both should be legacy xorg specific; eg. urxvt.

Replace /usr/local/bin/screenshot:

grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y%m%d_%H%M%S%N.png')"

Replace /usr/local/bin/screenshot-selection:

dimensions=$(slurp 2>/dev/null)
if [ $? -eq 0 ]; then
    grim -g "$dimensions" "$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y%m%d_%H%M%S%N.png')"
else
    grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" "$(xdg-user-dir PICTURES)/screenshots/$(date +'%Y%m%d_%H%M%S%N.png')"
fi

Replace /usr/local/bin/wallpaper:

#!/bin/bash

# set sane defaults
[ -z "$wallpaper_sleep_for" ] && wallpaper_sleep_for="180"
[ -z "$wallpaper_path" ] && wallpaper_path="$(xdg-user-dir PICTURES)/wallpaper"
mkdir -p "$wallpaper_path"

# validate wallpaper path
[ $(find "$wallpaper_path" -type f | wc -l) -gt 0 ] || exit 1

# there can be only one
while [ $(ps aux | grep -v 'grep' | grep -c "$0") -gt 2 ]; do
    kill $(ps aux | grep -v 'grep' | grep -v $$ | grep "$0" | awk '{print $2}') &> /dev/null
done

# infinitely change wallpaper
while true; do
    sway_outputs=( $(swaymsg -t get_outputs | jq -r '.[].name') )
    for op in "${sway_outputs[@]}"; do
        wp="$(find $wallpaper_path -type f | sort -R | tail -1)"
        swaymsg "output $op bg $wp" fit \#001E27
    done
    sleep $wallpaper_sleep_for
done

testing

  • sway launched without any issues
  • waybar is awesome, basically replaces both tint2 AND conky at the same time
    • can we resize and adjust what is displayed?
    • can we add cmst and launch from right click?
    • can we auto-hide/show with modifier keys so fullscreen apps work?
  • wofi is very fast and very clean, but it seems to be pulling from .desktop and not raw command line
    • can we disable history so when it cannot find something it doesn't launch the last thing it had?
    • figure out how to add and run raw cli commands and we'd be set!
    • can use mod+d for apps and mod+space for terminal commands!
    • I can also load a custom css to style it very nicely
  • alacritty is fast and works great so far, need to test unicode character support, but if so it might be time...
    • can possibly dump .Xdefaults?
  • firefox ran without xwayland, so it's native!! Woohoo!
  • wine, and specifically genshin, ran natively without using xwayland? Holy shit!
  • sublime text loaded and is wayland native (eg. no xlsclients)
  • Resolution was resolved, but adaptive sync only works with display port not hdmi sadly
    • genshin now perfectly launches filling the screen without waybar, so maybe it's a non-issue?
  • used mozilla gum_test to verify webcam, mic, and screen sharing worked
  • I should also investigate get_inputs to see what config options I have there!
    • namely for mouse and touchpad fine-tuning defaults; if they aren't already

https://developers.redhat.com/blog/2016/10/28/what-comes-after-iptables-its-successor-of-course-nftables https://wiki.nftables.org/wiki-nftables/index.php/Main_differences_with_iptables https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables https://ungleich.ch/en-us/cms/blog/2018/08/18/iptables-vs-nftables/ https://github.com/swaywm/sway/issues/3319 https://github.com/swaywm/sway/blob/master/config.in https://github.com/jdonofrio728/swaywm-bg-changer/blob/master/swaywm-bg-changer https://github.com/jdonofrio728/swaywm-bg-changer https://www.reddit.com/r/swaywm/comments/ehqsuw/autochanging_background_for_sway/ https://github.com/swaywm/sway/issues/5006 https://wiki.archlinux.org/title/Polkit https://forums.centos.org/viewtopic.php?t=70139 https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland https://www.reddit.com/r/swaywm/comments/epp0r4/unable_to_configure_the_cursor_theme/ https://wiki.archlinux.org/title/x_resources