feat: add kiosk mode#23
Open
ebrevdo wants to merge 1 commit into
Open
Conversation
Add a public kiosk mode for screen-owning prompts across the Node API, CLI, and JSON protocol. open(..., { kiosk: true }) forwards --kiosk, win.kiosk(enabled) sends a runtime protocol command, and native hosts report a kiosk event with active/reason state so callers can tell whether shortcut control was actually installed.
Kiosk mode intentionally has a different contract from floating or follow-cursor windows: it owns the active display, opens borderless/fullscreen, focuses the WebView for normal typing, and asks the OS or compositor to keep common window-switching shortcuts inside the session. Because geometry and cursor-following options conflict with that contract, the Node wrapper now drops width, height, x, y, followCursor, followMode, cursorAnchor, and cursorOffset when kiosk is enabled and emits GLIMPSE_KIOSK_IGNORED_OPTIONS instead of passing contradictory flags downstream.
Implementation notes:
- macOS uses the screen containing the pointer, a borderless screen-saver-level window, AppKit presentation options for process-switch inhibition, and restores presentation state on disable/close.
- Linux native uses the pointer monitor, X11 keep-above plus active keyboard grab, layer-shell geometry where available, and GDK shortcut inhibition on Wayland compositors that support it. X11-specific FFI is isolated in src/linux/src/x11.rs, and layer-shell setup is gated to cases that need it.
- Windows uses the screen containing the pointer, a borderless topmost form, and a low-level keyboard hook for common switch-away shortcuts, with hook cleanup on disable/close.
- The Chromium fallback passes Chromium's --kiosk flag and can open fullscreen, but reports active:false because it cannot reliably inhibit OS-level shortcuts.
Docs and CLI help now describe kiosk behavior, backend limitations, ignored options, and the kiosk status event. The agent skill has a matching usage note. A new mock-host kiosk regression test verifies launch flag mapping, ignored-option warnings, kiosk event handling, and runtime disable protocol.
Verification:
- npm test
- npm run test:platform
- npm run build:linux
- npm run build:windows
- node --check src/glimpse.mjs bin/glimpse.mjs src/chromium-backend.mjs test/kiosk.test.mjs
- rustfmt --check --config skip_children=true src/main.rs src/protocol.rs src/sysinfo.rs src/x11.rs
- git diff --check
Runtime behavior has currently only been tested on Linux X11/Wayland so far; macOS and Windows have build/protocol coverage from this pass but still need hands-on interactive runtime verification.
Author
|
update: tested and it works with macos |
Author
|
@HazAT ptal? |
Owner
|
hey @ebrevdo sorry for the late response if I understand this correctly, isn't what you are doing here just the more robust/better approach how Glimpse should function in the first place? |
Author
|
Not necessarily? You can open a full window without disabling alt+tab, ctrl+esc and other shortcuts. This is for dialogs that are meant to stay in front until closed... It doesn't seem like that's the main goal of glimpse. |
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.
Add a public kiosk mode for screen-owning prompts across the Node API, CLI, and JSON protocol. open(..., { kiosk: true }) forwards --kiosk, win.kiosk(enabled) sends a runtime protocol command, and native hosts report a kiosk event with active/reason state so callers can tell whether shortcut control was actually installed.
Kiosk mode intentionally has a different contract from floating or follow-cursor windows: it owns the active display, opens borderless/fullscreen, focuses the WebView for normal typing, and asks the OS or compositor to keep common window-switching shortcuts inside the session. Because geometry and cursor-following options conflict with that contract, the Node wrapper now drops width, height, x, y, followCursor, followMode, cursorAnchor, and cursorOffset when kiosk is enabled and emits GLIMPSE_KIOSK_IGNORED_OPTIONS instead of passing contradictory flags downstream.
Implementation notes:
macOS uses the screen containing the pointer, a borderless screen-saver-level window, AppKit presentation options for process-switch inhibition, and restores presentation state on disable/close.
Linux native uses the pointer monitor, X11 keep-above plus active keyboard grab, layer-shell geometry where available, and GDK shortcut inhibition on Wayland compositors that support it. X11-specific FFI is isolated in src/linux/src/x11.rs, and layer-shell setup is gated to cases that need it.
Windows uses the screen containing the pointer, a borderless topmost form, and a low-level keyboard hook for common switch-away shortcuts, with hook cleanup on disable/close.
The Chromium fallback passes Chromium's --kiosk flag and can open fullscreen, but reports active:false because it cannot reliably inhibit OS-level shortcuts.
Docs and CLI help now describe kiosk behavior, backend limitations, ignored options, and the kiosk status event. The agent skill has a matching usage note. A new mock-host kiosk regression test verifies launch flag mapping, ignored-option warnings, kiosk event handling, and runtime disable protocol.
Verification:
npm test
npm run test:platform
npm run build:linux
npm run build:windows
node --check src/glimpse.mjs bin/glimpse.mjs src/chromium-backend.mjs test/kiosk.test.mjs
rustfmt --check --config skip_children=true src/main.rs src/protocol.rs src/sysinfo.rs src/x11.rs
git diff --check
Runtime behavior has currently only been tested on Linux X11/Wayland so far; macOS and Windows have build/protocol coverage from this pass but still need hands-on interactive runtime verification.