Commit Graph

37 Commits

Author SHA1 Message Date
felixzsh fb7266153e docs: remove mouse capture form roadmap 2026-08-12 11:16:51 -05:00
felixzsh f705ccb37f fix: keep only complete combos in the history
The Lua emits on every key-down, so a chord pressed key-by-key without
releasing arrives as growing states (Super, Super Ctrl, Super Ctrl
Shift, Super Ctrl Shift 1). The history treated each one as a separate
combo, filling the stack with partial noise. Now a growing state while
the chord is still held (a strict superset of the current entry) updates
the entry in place instead of pushing a history row; only the complete
combo at release ever enters the history.
2026-08-12 10:59:09 -05:00
felixzsh 0a4aa59ee1 feat: add combo mode with combo counter, score and escalating effects
A 'Combo mode' toggle turns the display into a game-style counter.
Chords containing a modifier (Super/Ctrl/Alt/Shift/Menu/AltGr) are
combos: they build a combo counter, apply a multiplier (x2 at 5, x3 at
10 ... x8 at 50) and escalate the effects. Plain characters and shifted
chars typed alone are hits: +10 score only, they never touch the combo
counter or its window. Scoring: hit = 10, combo = (20 + 15*(mods-1) +
5*(keys-1)) * multiplier.

Counted once per physical chord on the Lua's empty payload (release),
so the intermediate growing emits of a chord never double-count. The
banner (COMBO 12 x3 - 3,450) sits below the history for bottom
positions and above it for top positions, with a floating +N pop per
press. Effects scale with modifiers and chain length: banner pulse,
hue shift, screen shake (up to 5px), continuous hue cycling at 10+
combos and a constant subtle vibration at 20+. The combo resets after
comboWindowMs (2s) without a new combo; the score accumulates for the
shell session.

Also fixes the README Behavior section: the history bullet was never
applied (a failed multi-edit call), now restored alongside the combo
mode docs. Manifest bumped to 1.7.0.
2026-08-12 10:51:01 -05:00
felixzsh 58cca5ec4f chore: rename mode label to filter 2026-08-12 10:27:17 -05:00
felixzsh d6c608374c feat: add stacking history with fading older entries
The last historyCount combos (1-5, default 1) stack on screen instead
of vanishing: each new combo pushes the previous one down the stack and
every older entry fades step by step (entryOpacity gradient). The stack
direction follows the position by default — top positions grow downward
(newest on top), bottom positions grow upward (newest at the bottom
edge) — and is not configurable. The panel gains a History NumberField
for the count.

Middle positions (center-left/center-right/center-center) were removed
from the dropdown and any leftover config value is folded into the
bottom row. With lingerMs 0 entries never expire, so the stack keeps
the last few combos on screen until newer ones push them out.

Manifest bumped to 1.6.0.
2026-08-12 10:06:40 -05:00
felixzsh d1afc68b70 chore: add seconds text to linger label 2026-08-12 08:53:21 -05:00
felixzsh 05e52219c5 change preview image 2026-08-11 18:16:25 -05:00
felixzsh 4b87cac3c8 Add author to the manifest for the Quattro contract
The documented plugin manifest contract (docs/omarchy-shell.md) and every
first-party manifest include author; the publishing validation rejects a
manifest without it.
2026-08-11 17:56:03 -05:00
felixzsh 076bef95f5 Add a Preview section with the screenshot to the README 2026-08-11 17:37:36 -05:00
Felix Sanchez c68d3644f8 add preview 2026-08-11 17:36:41 -05:00
felixzsh 21f9f3fb57 Measure each chip with FontMetrics.advanceWidth
The shared TextMetrics had its text set imperatively inside the width
bindings, which went stale from the third chip on — every container
collapsed to single-char width, so Super/Space/Backspace were illegible
in combos of 3+. FontMetrics.advanceWidth(text) is a stateless method,
so every chip gets its own correct width.
2026-08-11 17:31:36 -05:00
felixzsh 3d42d0e726 Fix the Linger row layout: fixed-size container, stable field
The hint slot is always reserved on the right (fixed width), the field
keeps a constant width, and the row has a fixed height with everything
vertically centered — the hint no longer sits at the top-right corner
and the field no longer resizes when it appears. Hint text is body size
like the other menu labels.

Align the never-hide hint to the SpinBox center

Anchoring the hint to the row container left it offset whenever the
row's implicit height differed from the field's rendered height. Anchor
to lingerField.field (the NumberField exposes the SpinBox) so the hint
always sits exactly beside the field.

Place the never-hide hint right next to the field

Anchor the hint to the SpinBox's right edge with the field's own height
and vertical center, so it reads as part of the control instead of a
floating label at the row edge.

Rebuild the Linger row as a plain RowLayout

NumberField is a Column (label above the field), and anchoring the hint
to its field alias left the text unanchored when the alias did not
resolve, dumping it at (0,0) over the label. A RowLayout puts label,
field, and hint in the flow, vertically centered by Layout.alignment —
no anchors, no aliases. The field comes first, so the hint never moves
it.

Move the Linger label above the field, Position-style

Label above (caption, bold, darkened — identical to the Dropdown label),
the field pinned to the left half, and the never-hide legend on the
right half via a fill-width spacer, so it appears only at 0 without
moving the field.
2026-08-11 17:19:17 -05:00
felixzsh 0e9adf5a6c Show a 'never hide' hint next to Linger when it is 0
When lingerMs is 0 (always show), a muted caption appears on the right of
the field so the opt-in is visible at a glance; the field shrinks to make
room. Config unchanged.
2026-08-11 16:52:37 -05:00
felixzsh e7232840cb Add a Linger NumberField to the menu
Native qs.Ui.NumberField (SpinBox) for lingerMs: mouse wheel, +/- buttons
and typing, 0-10000ms in 500ms steps, writing config.json like Mode and
Position so the display updates live. 0 selects the always-show behavior
from the previous commit.
2026-08-11 16:23:34 -05:00
felixzsh a5c31aaef7 lingerMs 0 keeps the last combo on screen until the next key
The hide timer only starts (and only clears) when lingerMs > 0, so 0
means the last full combo stays visible until the next key replaces it
— the keyviz-video look, as an explicit opt-in rather than the previous
behavior where 0 hid instantly.
2026-08-11 16:23:00 -05:00
felixzsh a22c8eaa78 Replace the position buttons with a native Dropdown (9 placements)
The three Position buttons (Bottom/Top/Center) overlapped the label in
the menu's width. Use qs.Ui.Dropdown with the full 3x3 grid — top /
middle / bottom by left / center / right — the display panel already
positions all of them.
2026-08-11 15:45:40 -05:00
felixzsh 7e079de572 Fix the bar glyph: \uF030C parsed as \uF030 + "C"
JS \u takes exactly 4 hex digits, so \uF030C rendered U+F030 (fa-camera
in the Nerd Font's Font Awesome range) followed by a literal C — a camera
with a trailing c, exactly what was on the bar. U+F030C is in PUA-A and
needs a UTF-16 surrogate pair: \uDB80\uDF0C. Also correct the comment
name (it is md-keyboard, not md-keyboard_outline).
2026-08-11 15:41:22 -05:00
felixzsh 840e7c2e13 Point README folder references at the renamed repo 2026-08-11 15:25:34 -05:00
felixzsh cabdf1307c Treat key combinations as a unit (combos)
The display now only updates on key-down (the combo grows as you press)
and when the last key is released (the empty payload starts the linger
with the last full combo). Intermediate releases no longer shrink the
display, so the order you let go of a shortcut doesn't matter: Ctrl+Shift+N
stays Ctrl+Shift+N whether Ctrl, Shift, or N goes up first, and the 1s
linger shows the full combo instead of a partial release state. Matches
the keybinding-tutorial use case better than keyviz, which shrinks
key-by-key on spaced releases.
2026-08-11 14:57:45 -05:00
felixzsh f53d2553d6 Document the stale-component caveat after plugin updates 2026-08-11 14:18:05 -05:00
felixzsh 34646dec28 Fix pause toggle: never delete the flag file
The FileView watcher fires on content changes but not on deletion, so
resuming (rm of the flag) left the panel and the menu stuck paused.
Rewrite the flag with 0 or 1 instead, matching the state-file pattern
that already works.
2026-08-11 14:03:12 -05:00
felixzsh f255fa05e9 Fix the Show keys toggle: flip the real paused state
ToggleSwitch does not flip checked on click — it only emits toggled()
and the caller owns the value. Reading !checked there yielded the
current bound state, so setPaused's guard always early-returned and the
toggle never did anything. Flip !root.paused instead; the checked
binding follows the flag file.
2026-08-11 13:58:48 -05:00
felixzsh ccce10d393 Document the new config location and why it lives outside the plugin dir 2026-08-11 13:42:24 -05:00
felixzsh 5670aca888 Move config out of the plugin dir so edits don't reload the plugin
The shell watches every file under ~/.config/omarchy/plugins/ with
inotify (no extension filter) and reloads all plugin code on any change,
so config.json there made every edit tear down and rebuild the panel and
bar widget. Config now lives at ~/.config/omarchy/key-visualizer.json, which
is not watched: edits update the display live. The panel migrates the
old plugin-dir config (values carried over, file removed) on first load
after the update.
2026-08-11 13:42:24 -05:00
felixzsh c0d491db29 Document the bar menu and the enable/rescan note 2026-08-11 13:26:32 -05:00
felixzsh 949f41a6be Turn the bar widget into a menu with toggle and display options
Clicking the keyboard glyph now opens a KeyboardPanel popup (the native
bar pattern, e.g. omarchy.audio) instead of toggling pause directly:
Show keys toggle, Mode (all | bindings), and Position (bottom/top/
center). The toggle writes the pause flag and the options write
config.json, both watched by the display panel, so menu and overlay
stay in sync across monitors. Replaces BarWidget.qml with a Panel-based
widget (Panel + BarIconButton + KeyboardPanel).
2026-08-11 13:26:32 -05:00
felixzsh 1b2128e6f1 Keep the bar button glyph in foreground color
active would paint the glyph with the urgent color while running, which
reads backwards for a toggle; dimmed alone is the paused cue.
2026-08-11 11:08:15 -05:00
felixzsh 1f532510a5 Make display options configurable via config.json
The panel reads config.json from its plugin folder (seeded with defaults
on first run, hot-reloaded on save): mode (all | bindings — the bindings
mode only shows combos with a modifier, ideal for keybinding tutorials),
position (keyviz-style alignment, bottom-center by default) and margin,
plus the existing lingerMs. Replaces the hardcoded bottom anchors with
x/y computed from position and margin.
2026-08-11 11:07:47 -05:00
felixzsh bd20dd8a9b Add bar widget to pause and resume the key display
A keyboard glyph in the bar (WidgetButton, right section by default)
toggles a pause flag at $XDG_RUNTIME_DIR/omarchy-key-visualizer.paused that
the panel and every bar widget instance watch, so a click on any monitor
updates all of them. While paused the panel ignores key state and hides;
the button dims. Also exposes pause/resume/toggle over the key-visualizer IPC
target.
2026-08-11 11:06:37 -05:00
felixzsh 7ab4d2f18d Linger on screen after release, keyviz-style
Previously the chips cleared the instant the keys were released, so the
120ms hide delay was invisible. Keep the last combo rendered for the
whole linger window and only clear it when the timer fires, so a quick
tap stays readable (keyviz keeps keys for lingerDurationMs, 5s by
default). Default 1000ms, tunable via lingerMs.
2026-08-11 10:52:54 -05:00
felixzsh 4955c33767 Auto-inject the Hyprland capture hook on plugin load
The capture script must run inside Hyprland's Lua config, but a plugin
cannot register itself in the user-owned hyprland.lua. On first load the
panel appends a small guarded block that dofiles key-visualizer.lua; Hyprland
auto-reloads its config on save, so install is now just add + enable.

The block is idempotent (marker comment), upgrades older plain dofile
lines, and no-ops when the plugin folder is removed so uninstalling never
breaks the config.
2026-08-11 10:11:35 -05:00
felixzsh 64e44c299b Rename plugin id to felixzsh.key-visualizer
omarchy plugin validate rejects the omarchy.* namespace: it is reserved
for first-party plugins. Use the third-party <user>.<name> convention.
2026-08-11 09:58:37 -05:00
felixzsh 96446661b3 Add install and usage docs 2026-08-11 09:53:48 -05:00
felixzsh d0a36e79dd Add key-visualizer panel UI 2026-08-11 09:53:48 -05:00
felixzsh 40bd0dd1f1 Add Hyprland Lua key capture 2026-08-11 09:53:48 -05:00
felixzsh 8cccf21f17 Add plugin manifest 2026-08-11 09:53:48 -05:00
felixzsh 7dcfee467e Add MIT license and gitignore 2026-08-11 09:53:48 -05:00