fix: restart Walker/elephant in portal recovery to fix clipboard

After v0.1.4 fixed the portal race, a user reported that the clipboard
also broke after returning from Gaming Mode. Symptom: paste does
nothing, Walker's clipboard history is empty.

Same root cause as the portal stack: Walker's elephant backend holds
the wl-clipboard listener, which is bound to the dead Hyprland's
Wayland socket after the SDDM restart. Fixed by appending a Walker
restart to deckshift-portal-recovery, using the existing
omarchy-restart-walker helper when present and falling back to direct
systemctl --user restart of elephant.service +
app-walker@autostart.service when not (keeps the helper portable for
the planned non-Omarchy targets).

Reported and validated by the same user as the v0.1.4 fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
28allday 2026-05-12 20:56:36 +01:00
parent ada71c9718
commit 4eaba97ade

View file

@ -34,7 +34,7 @@ set -Euo pipefail
# -u: Treat unset variables as errors (catches typos in variable names)
# -o pipefail: A pipeline fails if ANY command in it fails, not just the last one
DECKSHIFT_VERSION="0.1.4"
DECKSHIFT_VERSION="0.1.5"
# Resolve the directory this script lives in so we can find sibling files like
# bin/deckshift-settings and applications/deckshift-settings.desktop when
@ -2431,7 +2431,8 @@ KEYBIND_MONITOR
# screencast portal would bind to nothing. We now (a) push live session
# env into D-Bus + systemd --user so portals activate against the new
# Wayland socket, (b) stop portals first, (c) restart pipewire and wait
# for the graph, (d) start portals last.
# for the graph, (d) start portals last, (e) restart Walker/elephant so
# the clipboard listener reattaches to the live Wayland socket too.
info "Creating portal recovery helper..."
local portal_recovery="/usr/local/bin/deckshift-portal-recovery"
@ -2466,6 +2467,16 @@ sleep 2
# Now bring portals up cleanly.
systemctl --user start xdg-desktop-portal-hyprland.service xdg-desktop-portal.service 2>/dev/null || true
# Walker (elephant) holds the clipboard listener, which is also bound to the
# dead Hyprland's Wayland socket and stays broken until restarted. Prefer the
# omarchy helper if present; fall back to direct systemctl --user.
if command -v omarchy-restart-walker >/dev/null 2>&1; then
omarchy-restart-walker >/dev/null 2>&1 || true
else
systemctl --user restart elephant.service 2>/dev/null || true
systemctl --user restart app-walker@autostart.service 2>/dev/null || true
fi
PORTAL_RECOVERY
sudo chmod +x "$portal_recovery"