Skip to content

feat: add kiosk mode#23

Open
ebrevdo wants to merge 1 commit into
HazAT:mainfrom
ebrevdo:main
Open

feat: add kiosk mode#23
ebrevdo wants to merge 1 commit into
HazAT:mainfrom
ebrevdo:main

Conversation

@ebrevdo

@ebrevdo ebrevdo commented May 25, 2026

Copy link
Copy Markdown

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.

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.
@ebrevdo

ebrevdo commented May 25, 2026

Copy link
Copy Markdown
Author

update: tested and it works with macos

@ebrevdo

ebrevdo commented May 30, 2026

Copy link
Copy Markdown
Author

@HazAT ptal?

@HazAT

HazAT commented Jun 4, 2026

Copy link
Copy Markdown
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?

@ebrevdo

ebrevdo commented Jun 4, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants