fix(window): add in-page close button on Hyprland - #7
Open
Youpen-y wants to merge 1 commit into
Open
Conversation
On wlroots compositors the glimpse native window is a layer-shell Overlay with no title bar, so the review window could not be closed (no x button, killactive/Alt+F4/Esc ineffective). Detect Hyprland in the bridge via process.env (HYPRLAND_INSTANCE_SIGNATURE), inject a flag into the page HTML, and reveal an in-page x button wired to glimpse's existing window.glimpse.close() API. On macOS/Windows/X11/GNOME the system x is used and the in-page button stays hidden. Other wlroots compositors (Sway, River, ...) are theoretically affected but not yet verified. No changes to glimpse required.
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.
Fixes #6
Summary
On wlroots Wayland compositors the review window is a layer-shell Overlay with no title bar, so it has no way to be closed. Detect Hyprland in the bridge (tested) and reveal an in-page × button that calls glimpse's existing close API.
Problem
On wlroots-based Wayland compositors (tested on Hyprland; Sway/River theoretically affected) the review window cannot be closed by the user:
super+Q/Alt+F4/Escdon't work — it isn't a regular toplevel, so compositor window actions (killactive, closewindow) don't applyRoot cause
glimpse's native Linux backend renders the window as a layer-shell
Overlaysurface viagtk4-layer-shell:layer-shell surfaces carry no window decorations (no title bar, no ×) and aren't managed as regular toplevels by the compositor. and glimpse does expose a close API (
window.glimpse.close()→__glimpse_close→app.quit()atmain.rs:218), but review-loop never calls it: there's no close button in the UI and no keyboard binding.This only affects wlroots compositors. On macOS / Windows / X11 / GNOME-Wayland,
gtk4-layer-shellfalls back to a normal decorated toplevel (those compositors don't implementwlr-layer-shell), so the system × button is present.Solution
Detect Hyprland in the bridge (Node side, where
process.envis directly readable viaHYPRLAND_INSTANCE_SIGNATURE) and inject a flag into the page HTML. The web app renders an in-page × button only when the flag is set, and wires it to glimpse's existingwindow.glimpse.close().Solution
Detect Hyprland in the bridge (Node side, where
process.envis directly readable viaHYPRLAND_INSTANCE_SIGNATURE) and inject a flag into the page HTML. The web app renders an in-page × button only when the flag is set, and wires it to glimpse's existingwindow.glimpse.close().Limitations / future work
compositors (Sway →
SWAYSOCK, River, …) are theoretically affected (layer-shell has no decorations) but unverified, add their env vars once confirmed.