Repository navigation
ccbox: fall back to wayland-0 socket and warn when clipboard is unwirable - #92
Merged
Merged
Conversation
…able - add_clipboard_mounts() now uses \$WAYLAND_DISPLAY only when its socket exists, and falls back to \$XDG_RUNTIME_DIR/wayland-0 when the variable is unset or stale but the socket is live (shells born outside the graphical session: SSH, daemons, stripped envs) — mirrors libwayland's connect(NULL) default. - A clipboard-blind launch is no longer silent: log_warn 'No display server found' and the status line now reports enabled (Wayland) / (X11) / unavailable (no display server) instead of a blanket 'enabled'. - docs/usage.md clipboard section updated to match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add_clipboard_mounts()uses$WAYLAND_DISPLAYonly when its socket actually exists, and falls back to$XDG_RUNTIME_DIR/wayland-0when the variable is unset or stale but the socket is live — the same default as libwayland'swl_display_connect(NULL). This covers shells born outside the graphical session (SSH, daemons, stripped envs, terminal multiplexer servers), where the socket is present but the variable is not.log_warn "No display server found: clipboard image pasting will not work", and the status line reportsenabled (Wayland)/enabled (X11)/unavailable (no display server)instead of a blanketenabled.docs/usage.mdclipboard section updated to match.Context
Diagnosed from a real failure: on a Fedora workstation with a live
wayland-0socket andXDG_RUNTIME_DIRset, interactive shells had emptyWAYLAND_DISPLAY/DISPLAY(vars present in the systemd user environment but not inherited by the shell). The old detection required the variable, so ccbox launched containers with zero clipboard wiring and no message — image paste (Ctrl+V) silently did nothing, identical inside and outside Herdr. The fallback makes such a machine work out of the box; the warning makes any remaining case visible in one line.Verification
tests/render-test.sh: 48/48 ok, goldens unchanged (the fallback only fires when a socket exists, which the fixture env never has).shellcheck lib/box-common.sh+bash -nclean.WAYLAND_DISPLAY=wayland-0, statusenabled (Wayland)WAYLAND_DISPLAYwith existing socket → honoredWAYLAND_DISPLAY=wayland-99,wayland-0live → falls back, statusenabled (Wayland)[WARN] No display server found, statusunavailable (no display server)--no-clipboard→ statusdisabled, no mounts