diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-08-09 03:05:36 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:41:34 -0700 |
| commit | f1694b519cd73d1bf2b2424ed893489cd1a8d8b3 (patch) | |
| tree | b8e2bd4e54c7b06142508c9e60090a0882c38ebc /config/hypr/scripts | |
| parent | 1f754ef8cfc24cb29b18ba1bf905fb73e56e8d2e (diff) | |
Fix: waybar startup/restart in Fedora
Conflicts with waybar.service when hyprland-uwsm session not selected
Fixed startup config files
Added gate check for AGS to remove errors when not installed
Signed-off-by: Don Williams <don.e.williams@gmail.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: CHANGELOG.md
modified: config/hypr/configs/Startup_Apps.conf
modified: config/hypr/lua/startup.lua
modified: config/hypr/lua/user_startup_helper.lua
modified: config/hypr/scripts/DarkLight.sh
modified: config/hypr/scripts/PortalHyprland.sh
modified: config/hypr/scripts/Refresh.sh
modified: config/hypr/scripts/ToggleWaybarTime.sh
modified: config/hypr/scripts/WaybarStartup.sh
modified: scripts/migrate-hypr-to-lua.sh
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/DarkLight.sh | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/PortalHyprland.sh | 14 | ||||
| -rwxr-xr-x | config/hypr/scripts/Refresh.sh | 19 | ||||
| -rwxr-xr-x | config/hypr/scripts/ToggleWaybarTime.sh | 6 | ||||
| -rwxr-xr-x | config/hypr/scripts/WaybarStartup.sh | 49 |
5 files changed, 43 insertions, 48 deletions
diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index fa62ebc2..913099fc 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -174,9 +174,8 @@ set_waybar_style() { theme="$1" waybar_styles="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/style" waybar_style_link="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/style.css" - style_prefix="\\[${theme}\\].*\\.css$" - style_file=$(find -L "$waybar_styles" -maxdepth 1 -type f -regex ".*$style_prefix" | shuf -n 1) + style_file=$(find -L "$waybar_styles" -maxdepth 1 -type f \( -iname "${theme}-*.css" -o -iname "${theme}_*.css" -o -iname "[${theme}]*.css" -o -iname "${theme}*.css" \) | shuf -n 1) if [ -n "$style_file" ]; then ln -sf "$style_file" "$waybar_style_link" diff --git a/config/hypr/scripts/PortalHyprland.sh b/config/hypr/scripts/PortalHyprland.sh index 54ea71bb..e1ed2cae 100755 --- a/config/hypr/scripts/PortalHyprland.sh +++ b/config/hypr/scripts/PortalHyprland.sh @@ -120,12 +120,14 @@ restart_portal_via_systemd() { done systemctl --user start xdg-desktop-portal-hyprland.service >/dev/null 2>&1 || true - if is_ubuntu_family; then + if command -v /usr/libexec/xdg-desktop-portal-gtk >/dev/null 2>&1 || command -v /usr/lib/xdg-desktop-portal-gtk >/dev/null 2>&1 || is_ubuntu_family; then systemctl --user start xdg-desktop-portal-gtk.service >/dev/null 2>&1 || true fi + systemctl --user start xdg-desktop-portal.service >/dev/null 2>&1 || true for _ in $(seq 1 60); do - if systemctl --user is-active --quiet xdg-desktop-portal-hyprland.service; then + if systemctl --user is-active --quiet xdg-desktop-portal-hyprland.service && \ + systemctl --user is-active --quiet xdg-desktop-portal.service; then return 0 fi sleep 0.1 @@ -144,11 +146,9 @@ restart_portal_manually() { sleep 2 - if is_ubuntu_family; then - start_portal_binary "xdg-desktop-portal-gtk" \ - /usr/lib/xdg-desktop-portal-gtk \ - /usr/libexec/xdg-desktop-portal-gtk || true - fi + start_portal_binary "xdg-desktop-portal-gtk" \ + /usr/lib/xdg-desktop-portal-gtk \ + /usr/libexec/xdg-desktop-portal-gtk || true start_portal_binary "xdg-desktop-portal" \ /usr/lib/xdg-desktop-portal \ diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index a35b735a..79495d0f 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -33,7 +33,10 @@ pkill -f 'waybar-cava\..*\.conf' 2>/dev/null || true # quit ags & relaunch ags -ags -q && ags & +if command -v ags >/dev/null 2>&1; then + ags -q >/dev/null 2>&1 || true + ags >/dev/null 2>&1 & +fi # quit quickshell & relaunch quickshell pkill qs && qs --log-rules "$QS_TEXTINPUT_LOG_RULE" & @@ -49,8 +52,10 @@ restart_waybar() { local manage_with_systemd=0 if command -v systemctl >/dev/null 2>&1; then - if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then - manage_with_systemd=1 + if systemctl --user --quiet is-active graphical-session.target 2>/dev/null || systemctl --user --quiet is-active wayland-session@*.target 2>/dev/null; then + if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then + manage_with_systemd=1 + fi fi fi @@ -80,9 +85,11 @@ restart_waybar # relaunch swaync sleep 0.3 -swaync >/dev/null 2>&1 & -# reload swaync -swaync-client --reload-config +if ! pidof swaync >/dev/null 2>&1; then + swaync >/dev/null 2>&1 & +fi +# reload swaync (asynchronous to prevent DBus timeout delays) +(swaync-client --reload-config >/dev/null 2>&1 &) # Relaunching rainbow borders based on selected mode sleep 1 diff --git a/config/hypr/scripts/ToggleWaybarTime.sh b/config/hypr/scripts/ToggleWaybarTime.sh index 2273c3af..54eefb57 100755 --- a/config/hypr/scripts/ToggleWaybarTime.sh +++ b/config/hypr/scripts/ToggleWaybarTime.sh @@ -59,8 +59,10 @@ restart_waybar() { local manage_with_systemd=0 if command -v systemctl >/dev/null 2>&1; then - if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then - manage_with_systemd=1 + if systemctl --user --quiet is-active graphical-session.target 2>/dev/null || systemctl --user --quiet is-active wayland-session@*.target 2>/dev/null; then + if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then + manage_with_systemd=1 + fi fi fi diff --git a/config/hypr/scripts/WaybarStartup.sh b/config/hypr/scripts/WaybarStartup.sh index 8cd36efb..7f8ee1e2 100755 --- a/config/hypr/scripts/WaybarStartup.sh +++ b/config/hypr/scripts/WaybarStartup.sh @@ -62,17 +62,11 @@ start_portal_services() { } wait_for_wayland() { - # If WAYLAND_DISPLAY is already valid, use it. if [ -n "${WAYLAND_DISPLAY:-}" ] && [ -S "$runtime_dir/$WAYLAND_DISPLAY" ]; then return 0 fi - # Otherwise wait briefly for an available Wayland socket. - for _ in $(seq 1 120); do - if [ -n "${WAYLAND_DISPLAY:-}" ] && [ -S "$runtime_dir/$WAYLAND_DISPLAY" ]; then - return 0 - fi - + for _ in $(seq 1 30); do for socket in "$runtime_dir"/wayland-[0-9]*; do [ -S "$socket" ] || continue case "$(basename "$socket")" in @@ -87,48 +81,41 @@ wait_for_wayland() { return 1 } +ensure_wallust_waybar_colors() { + local colors_file="${XDG_CONFIG_HOME:-$HOME/.config}/waybar/wallust/colors-waybar.css" + mkdir -p "$(dirname "$colors_file")" 2>/dev/null || true + if [ ! -f "$colors_file" ]; then + touch "$colors_file" 2>/dev/null || true + fi + if [ ! -s "$colors_file" ] && [ -x "$SCRIPTSDIR/WallustSwww.sh" ]; then + "$SCRIPTSDIR/WallustSwww.sh" >/dev/null 2>&1 & + fi +} + start_waybar_direct() { if command -v waybar >/dev/null 2>&1; then waybar >/dev/null 2>&1 & - wait_for_waybar - return $? + return 0 fi if command -v .waybar-wrapped >/dev/null 2>&1; then .waybar-wrapped >/dev/null 2>&1 & - wait_for_waybar - return $? + return 0 fi return 1 } -start_waybar_via_systemd() { - [ -x "$(command -v systemctl)" ] || return 1 - - local load_state - load_state="$(systemctl --user show waybar.service --property=LoadState --value 2>/dev/null || true)" - [ -n "$load_state" ] && [ "$load_state" != "not-found" ] || return 1 - - systemctl --user start waybar.service >/dev/null 2>&1 || return 1 - wait_for_waybar -} - main() { - wait_for_wayland || true - sync_portal_env - # Portal services are already started by PortalHyprland.sh; no need to wait here. - ensure_wallust_waybar_colors || true - is_waybar_running && exit 0 + wait_for_wayland || true + sync_portal_env || true + ensure_wallust_waybar_colors if start_waybar_via_systemd || start_waybar_direct; then exit 0 fi - # One retry after attempting to refresh wallust templates. - ensure_wallust_waybar_colors || true - sleep 0.3 - start_waybar_via_systemd || start_waybar_direct || exit 1 + exit 1 } main |
