# 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 - research firefox auto-configuration _or_ copying configuration files (_eg. if plain text can add to dot-files_): - https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig - verify if it remembers workspaces when re-opened - test/fix multimedia keys for volume change support (_may require actual hardware; would also consider popup icons?_) - https://www.reddit.com/r/swaywm/comments/bwwxg0/xf86_audio_keys/ - add `yad` to packages as a wayland-native `zenity` alternative - add messages to waybar for battery - add messages to pash for volume changes? - install `cmst` from aur and try it out as an option for wifi support - https://aur.archlinux.org/packages/cmst/ - investigate using `scratchpad` feature of `sway` for persistent terminal with toggle hotkey - investigate creating workspace affinities for things like fullscreen games so it automates placement/movement - set sway config to load userspace `.d` directory for custom settings - touchpad-specific configuration; we may be able to add a default if we can identify ideal settings... - display-specific configuration - on real hardware I'll need to test/refine sway config hotkeys for better navigation - test creating workspace "affinity" for games and videos etc... so they open into a desirable placement? - multi-monitor support and configuration; I'll need hotkeys that move applications between displays - supposedly each monitor is treated as a separate workspace, so this might work well - https://www.reddit.com/r/swaywm/comments/gr7yvt/assigning_workspaces_to_specific_outputs/ - https://fedoramagazine.org/how-to-setup-multiple-monitors-in-sway/ - https://www.reddit.com/r/swaywm/comments/ftuiqa/is_it_possible_to_set_my_starting_workspace/ - test left/right arrow navigation; both changing workspaces and also displays - _can this be used for all workspaces or only numbered?_ - _Does it loop?_ ### 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