Skip to content

feat: cursor-position launch, keyboard refactor, test suite#16

Merged
d7omdev merged 6 commits intomainfrom
dev
Apr 17, 2026
Merged

feat: cursor-position launch, keyboard refactor, test suite#16
d7omdev merged 6 commits intomainfrom
dev

Conversation

@d7omdev
Copy link
Copy Markdown
Owner

@d7omdev d7omdev commented Apr 17, 2026

Summary

  • Cursor-position launch (compact mode): In compact mode, the window now opens at the mouse cursor instead of the default compositor placement. Uses gtk-layer-shell for Wayland positioning and hyprctl for cursor queries. Includes monitor-aware clamping and stale-socket auto-recovery. Closes Place floating window under the cursor #9
  • Keyboard dispatch refactor: Replaced the 290-line on_key_press if/elif chain with a (ctrl, shift, keyval) dispatch table for O(1) lookup. Each key action is now a small named method.
  • Test suite: 276 pytest tests covering keyboard mixin, utils, detection, text, config manager, and CLI. Added just test recipe.

Cursor-position launch — experimental

Note

The "window under cursor" feature is experimental and currently only supports Hyprland (via hyprctl + gtk-layer-shell).

The positioning layer (gtk-layer-shell) works on all wlroots compositors (Sway, river, wayfire, etc.), but the cursor query currently only supports Hyprland's IPC.

If you need support for a specific compositor, please open an issue with the compositor name and we'll look into adding it.

How it works

Component Scope Purpose
gtk-layer-shell All wlroots compositors Positions window via anchor + margins
hyprctl cursorpos Hyprland only Queries cursor coordinates
hyprctl monitors -j Hyprland only Converts global → monitor-local coords

On X11, falls back to standard window.move(). On unsupported Wayland compositors, the window uses default placement (no crash).

Dependencies

  • gtk-layer-shell (optional) — pacman -S gtk-layer-shell on Arch

Test plan

  • Compact mode launches at cursor on Hyprland
  • Window stays within monitor bounds (edge clamping)
  • Stale HYPRLAND_INSTANCE_SIGNATURE auto-recovered
  • Non-compact mode unaffected (default placement)
  • All 276 tests pass (just test)
  • Ruff lint clean

d7omdev added 6 commits April 17, 2026 23:51
Replace the 290-line on_key_press if/elif chain with a (ctrl, shift, keyval)
dispatch dict for O(1) lookup. Extract search-focused handling and each
key action into small named methods.
In compact mode, position the window at the mouse cursor using
gtk-layer-shell (anchor top-left + margins). Cursor coordinates
are queried via hyprctl and converted to monitor-local offsets.
Includes screen-bounds clamping and stale-socket auto-recovery.

Closes #9
Add tests for keyboard mixin (65), utils (fuzzy search, date format),
detection (URL/SVG/data-URI), text (markup escaping, highlighting),
config manager (load/save/type coercion), and CLI (arg parsing, logging).
276 tests total. Add 'just test' recipe to the QA group.
Run ruff lint and pytest on ubuntu with GTK3 system packages.
Triggers on push to main/dev and on PRs to main.
setup-python installs an isolated Python that can't see apt-installed
python3-gi. Switch test job to system python3 + python3-pytest.
@d7omdev d7omdev merged commit 22228de into main Apr 17, 2026
4 checks passed
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.

Place floating window under the cursor

1 participant