I’ve been using my patch for a while now and I believe it is quite reliable. I never had any race conditions with either the panel or waybar since.
Here’s a patch in case someone needs it. Tested locally and passes shellcheck. If a maintainer wants to merge it, even better. I hereby put this patch in the public domain, or CC0
diff --git a/usr/libexec/user-sysmaint-split/sysmaint-session b/usr/libexec/user-sysmaint-split/sysmaint-session
index 06f47d5..10c2dde 100755
--- a/usr/libexec/user-sysmaint-split/sysmaint-session
+++ b/usr/libexec/user-sysmaint-split/sysmaint-session
@@ -35,23 +35,6 @@ for sysmaint_app in "${sysmaint_app_list[@]}"; do
fi
done
-system_tray_list=(
- '/usr/bin/trayer'
-)
-system_tray_arg_list=(
- '--edge top --align right --SetPartialStrut true'
-)
-selected_system_tray=''
-selected_system_tray_args=''
-
-for (( idx = 0; idx < ${#system_tray_list[@]}; idx++ )); do
- if [ -e "${system_tray_list[idx]}" ]; then
- selected_system_tray="${system_tray_list[idx]}"
- selected_system_tray_args="${system_tray_arg_list[idx]}"
- break
- fi
-done
-
if [ -z "${selected_window_manager}" ]; then
printf "%s\n" "$0: ERROR: Could not find a supported window manager!" >&2
exit 1
@@ -68,13 +51,10 @@ write_sysmaint_account_specific_config_once
"${selected_window_manager}" &
# Needed to prevent window ordering problems
light_sleep 1
-if [ -n "${selected_system_tray}" ]; then
- # shellcheck disable=SC2086
- "${selected_system_tray}" ${selected_system_tray_args} &
-fi
+/usr/libexec/user-sysmaint-split/sysmaint-session-startup &
+
"${selected_sysmaint_app}" &
sysmaint_app_pid="$!"
-start_user_background_services
wait "${sysmaint_app_pid}"
diff --git a/usr/libexec/user-sysmaint-split/sysmaint-session-startup b/usr/libexec/user-sysmaint-split/sysmaint-session-startup
new file mode 100755
index 0000000..cf2e68a
--- /dev/null
+++ b/usr/libexec/user-sysmaint-split/sysmaint-session-startup
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+## Copyright (C) 2024 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
+## See the file COPYING for copying conditions.
+
+# shellcheck source=./sysmaint-session-shared
+source /usr/libexec/user-sysmaint-split/sysmaint-session-shared
+
+system_tray_list=(
+ '/usr/bin/trayer'
+)
+system_tray_arg_list=(
+ '--edge top --align right --SetPartialStrut true'
+)
+
+if [ "$XDG_SESSION_TYPE" = 'wayland' ]; then
+ system_tray_list=(
+ '/usr/bin/waybar'
+ )
+ system_tray_arg_list=(
+ ''
+ )
+fi
+
+selected_system_tray=''
+selected_system_tray_args=''
+
+for (( idx = 0; idx < ${#system_tray_list[@]}; idx++ )); do
+ if [ -e "${system_tray_list[idx]}" ]; then
+ selected_system_tray="${system_tray_list[idx]}"
+ selected_system_tray_args="${system_tray_arg_list[idx]}"
+ break
+ fi
+done
+
+if [ -n "${selected_system_tray}" ]; then
+ # shellcheck disable=SC2086
+ "${selected_system_tray}" ${selected_system_tray_args} &
+fi
+
+start_user_background_services
diff --git a/usr/libexec/user-sysmaint-split/sysmaint-session-wayland b/usr/libexec/user-sysmaint-split/sysmaint-session-wayland
index d9faaaa..e5016fc 100755
--- a/usr/libexec/user-sysmaint-split/sysmaint-session-wayland
+++ b/usr/libexec/user-sysmaint-split/sysmaint-session-wayland
@@ -86,23 +86,6 @@ for sysmaint_app in "${sysmaint_app_list[@]}"; do
fi
done
-system_tray_list=(
- '/usr/bin/waybar'
-)
-system_tray_arg_list=(
- ''
-)
-selected_system_tray=''
-selected_system_tray_args=''
-
-for (( idx = 0; idx < ${#system_tray_list[@]}; idx++ )); do
- if [ -e "${system_tray_list[idx]}" ]; then
- selected_system_tray="${system_tray_list[idx]}"
- selected_system_tray_args="${system_tray_arg_list[idx]}"
- break
- fi
-done
-
if [ -z "${selected_window_manager}" ]; then
printf "%s\n" "$0: ERROR: Could not find a supported window manager!" >&2
exit 1
@@ -141,6 +124,13 @@ if has pactl; then
fi
fi
+if [ "${selected_window_manager}" = '/usr/bin/labwc' ]; then
+ # shellcheck disable=SC2086
+ exec "${selected_window_manager}" ${selected_window_manager_args} \
+ --session "${selected_sysmaint_app}" \
+ --startup "/usr/libexec/user-sysmaint-split/sysmaint-session-startup"
+fi
+
# shellcheck disable=SC2086
"${selected_window_manager}" ${selected_window_manager_args} &
## Needed to prevent window ordering and initialization problems
@@ -179,14 +169,9 @@ while read -r systemd_env_line; do
fi
done < <(systemctl --user show-environment)
-if [ -n "${selected_system_tray}" ]; then
- # shellcheck disable=SC2086
- "${selected_system_tray}" ${selected_system_tray_args} &
-fi
+/usr/libexec/user-sysmaint-split/sysmaint-session-startup &
"${selected_sysmaint_app}" &
sysmaint_app_pid="$!"
-start_user_background_services
-
wait "${sysmaint_app_pid}"
By the way, I wasted two days trying to register on GitHub to open a pull request but always got blocked or shadow-banned. I don’t know why GitHub is so hostile these days. And then I saw the first-time contributor guide saying pull requests are optional. If anyone wants me to push this to somewhere else, just say the word.