Skip to content

fix(linux): correct CLI arg parsing for negative numbers and platform-gated options#7

Merged
HazAT merged 1 commit intoHazAT:mainfrom
Whamp:fix/linux-cli-args
Mar 20, 2026
Merged

fix(linux): correct CLI arg parsing for negative numbers and platform-gated options#7
HazAT merged 1 commit intoHazAT:mainfrom
Whamp:fix/linux-cli-args

Conversation

@Whamp
Copy link
Contributor

@Whamp Whamp commented Mar 18, 2026

Summary

Fixes two issues preventing Glimpse from running correctly on Linux:

  1. Negative number CLI args — The Rust binary uses clap for argument parsing. Arguments like --cursor-offset-y -20 were being parsed as a flag -20 instead of a value. Changed to --cursor-offset-y=-20 syntax.

  2. Platform-gated options--open-links and --open-links-app were being passed on Linux but only implemented for macOS, causing the binary to fail with "unexpected argument" errors.

Changes

  • src/glimpse.mjs — Use --arg=value syntax for --x, --y, --cursor-offset-x, --cursor-offset-y to handle negative numbers correctly with clap
  • src/glimpse.mjs — Gate --open-links / --open-links-app to macOS only (allow override platform for mock binary testing)
  • test/test-status-item.mjs — Skip test on non-macOS platforms since statusItem() is macOS-only
  • src/linux/Cargo.lock — Add lockfile for reproducible Linux builds

Testing

Tested on Arch Linux (Omarchy) with Hyprland:

  • All existing tests pass
  • Manually verified:
    • Basic window opens and renders
    • Frameless + transparent + floating windows work
    • followCursor works on Hyprland (uses hyprctl cursorpos)
    • prompt() dialogs work

…-gated options

- Use --arg=value syntax for x, y, and cursor-offset args to handle
  negative numbers correctly with clap (e.g., --cursor-offset-y=-20
  instead of --cursor-offset-y -20 which clap interprets as a flag)

- Gate --open-links and --open-links-app to macOS only (with 'override'
  exception for mock binary testing). These flags are not implemented
  in the Linux/Windows binaries and were causing startup failures.

- Add skip guard in test-status-item.mjs for non-macOS platforms since
  statusItem() is a macOS-only feature.

- Include Cargo.lock for the Linux Rust binary to ensure reproducible
  builds.
Copy link
Owner

@HazAT HazAT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@HazAT HazAT merged commit 8d385d0 into HazAT:main Mar 20, 2026
HazAT added a commit that referenced this pull request Mar 20, 2026
Add changelog entry for the two community contributions in this release:

- PR #8 (@hjanuschka): Chromium CDP backend for Linux — a zero-compile
  alternative to WebKitGTK that auto-falls back to system Chromium via
  remote-debugging-pipe. Adds follow-cursor on X11, system tray support,
  and external link opening on Linux.

- PR #7 (@Whamp): Linux CLI fixes for negative number arg parsing and
  platform-gated options that caused startup failures.

Update README to document the Chromium CDP backend: platform table,
build instructions (Option A native / Option B zero-compile), expanded
platform notes matrix splitting Linux native vs Chromium columns,
GLIMPSE_BACKEND env var, and architecture listing.
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