From 6b0a66e6bec2a22255fa535c6ccd36b172aecac3 Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Fri, 9 Jun 2023 18:02:22 +0400 Subject: [PATCH] Swtich back from running apps with systemd systemd integration for Sway is cool, but introduces a lot of unexpected problems, such as race conditions. So switch back to classic config-based systemd for autostarting services until all major problems with systemd integration (sway-systemd) will resolved --- debian/control | 2 +- etc/skel/.config/waybar/config.jsonc.example | 5 +++++ etc/skel/.config/waybar/style.css.example | 1 + etc/sway/config.d/20-waybar.conf | 9 +++++++++ etc/sway/config.d/40-autostart-applications.conf | 4 ++++ etc/sway/environment | 3 +++ etc/sway/variables | 9 +++++++++ .../xdg-tileos}/waybar/config.jsonc | 0 .../.config => xdg/xdg-tileos}/waybar/style.css | 0 usr/share/sway/scripts/waybar.sh | 15 +++++++++++++++ 10 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 etc/skel/.config/waybar/config.jsonc.example create mode 100644 etc/skel/.config/waybar/style.css.example create mode 100644 etc/sway/config.d/20-waybar.conf rename etc/{skel/.config => xdg/xdg-tileos}/waybar/config.jsonc (100%) rename etc/{skel/.config => xdg/xdg-tileos}/waybar/style.css (100%) create mode 100755 usr/share/sway/scripts/waybar.sh diff --git a/debian/control b/debian/control index ffd8d42..261521b 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Homepage: https://github.com/Tile-OS/tileos-settings-sway.git Rules-Requires-Root: no Package: tileos-settings-sway -Architecture: any +Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: tileos-settings-river Description: default settings for Sway on TileOS diff --git a/etc/skel/.config/waybar/config.jsonc.example b/etc/skel/.config/waybar/config.jsonc.example new file mode 100644 index 0000000..0ace37f --- /dev/null +++ b/etc/skel/.config/waybar/config.jsonc.example @@ -0,0 +1,5 @@ +{ + "include": [ + "/etc/xdg/xdg-tileos/waybar/config.jsonc" + ] +} diff --git a/etc/skel/.config/waybar/style.css.example b/etc/skel/.config/waybar/style.css.example new file mode 100644 index 0000000..f62d5c3 --- /dev/null +++ b/etc/skel/.config/waybar/style.css.example @@ -0,0 +1 @@ +@import "/etc/xdg/xdg-tileos/waybar/style.css"; diff --git a/etc/sway/config.d/20-waybar.conf b/etc/sway/config.d/20-waybar.conf new file mode 100644 index 0000000..f25938b --- /dev/null +++ b/etc/sway/config.d/20-waybar.conf @@ -0,0 +1,9 @@ +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + id default + swaybar_command /usr/share/sway/scripts/waybar.sh + position top +} diff --git a/etc/sway/config.d/40-autostart-applications.conf b/etc/sway/config.d/40-autostart-applications.conf index a2ddaa6..d64b4d6 100644 --- a/etc/sway/config.d/40-autostart-applications.conf +++ b/etc/sway/config.d/40-autostart-applications.conf @@ -3,7 +3,9 @@ exec { $polkit_agent + $idle $swappy_notify + $dex_autostart $wlsunset $autotiling $term_server @@ -16,8 +18,10 @@ exec_always { $kanshi $spice_vdagent $nwg_drawer_daemon + $poweralertd $watch_playerctl $calendar_daemon $import_gsettings $update_rofi_theme + $swayr_daemon } diff --git a/etc/sway/environment b/etc/sway/environment index 5b05588..056c9c6 100644 --- a/etc/sway/environment +++ b/etc/sway/environment @@ -2,6 +2,9 @@ # from /usr/bin/start-sway script for all users of the system. # User-specific variables should be placed in $XDG_CONFIG_HOME/sway/environment +# TileOS specific config dir +export XDG_CONFIG_DIRS=/etc/xdg/xdg-tileos:/etc/xdg + # Force Wayland for Mozilla Firefox export MOZ_ENABLE_WAYLAND=1 export MOZ_DBUS_REMOTE=1 diff --git a/etc/sway/variables b/etc/sway/variables index 8c6849a..fb2185b 100644 --- a/etc/sway/variables +++ b/etc/sway/variables @@ -113,6 +113,15 @@ set $kanshi '[ -x "$(command -v kanshi)" ] && pkill kanshi; exec kanshi' # Workaround for applying GTK theme set $import_gsettings '[ -f /usr/share/sway/scripts/import-gsettings.sh ] && /usr/share/sway/scripts/import-gsettings.sh' +# Dex autostart daemon +set $dex_autostart '[ -x "$(command -v dex)" ] && gdbus wait --session org.kde.StatusNotifierWatcher && dex --autostart' + +# Swayr daemon +set $swayr_daemon '[ -x "$(command -v swayrd)" ] && env RUST_BACKTRACE=1 RUST_LOG=swayr=debug swayrd &> /tmp/swayrd.log' + +# Power notifications daemon +set $poweralertd '[ -x "$(command -v poweralertd)" ] && pkill poweralertd; poweralertd -s -i "line power" &' + # Start PCmanFM as a daemon set $pcmanfm_daemon '[ -x "$(command -v pcmanfm)" ] && pcmanfm -d' diff --git a/etc/skel/.config/waybar/config.jsonc b/etc/xdg/xdg-tileos/waybar/config.jsonc similarity index 100% rename from etc/skel/.config/waybar/config.jsonc rename to etc/xdg/xdg-tileos/waybar/config.jsonc diff --git a/etc/skel/.config/waybar/style.css b/etc/xdg/xdg-tileos/waybar/style.css similarity index 100% rename from etc/skel/.config/waybar/style.css rename to etc/xdg/xdg-tileos/waybar/style.css diff --git a/usr/share/sway/scripts/waybar.sh b/usr/share/sway/scripts/waybar.sh new file mode 100755 index 0000000..17fe02b --- /dev/null +++ b/usr/share/sway/scripts/waybar.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# wrapper script for waybar with args, see https://github.com/swaywm/sway/issues/5724 + +USER_CONFIG_PATH=$HOME/.config/waybar/config.jsonc +USER_STYLE_PATH=$HOME/.config/waybar/style.css + +if [ -f "$USER_CONFIG_PATH" ]; then + USER_CONFIG=$USER_CONFIG_PATH +fi + +if [ -f "$USER_STYLE_PATH" ]; then + USER_STYLE=$USER_STYLE_PATH +fi + +waybar -c "${USER_CONFIG:-"/etc/xdg/xdg-tileos/waybar/config.jsonc"}" -s "${USER_STYLE:-"/etc/xdg/xdg-tileos/waybar/style.css"}" &