omarchy dev ui-preview: jump to a specific section via argument

Pass a section name to open the gallery with the cursor already on
that component instead of scrolling from the top. Useful when
iterating on a single widget.

  omarchy dev ui-preview              # default position
  omarchy dev ui-preview button       # land on the Button section
  omarchy dev ui-preview button-group # land on ButtonGroup
  omarchy dev ui-preview slider       # land on Slider, etc.

The bin script forwards the argument as {"section": "..."} in the
shell summon payload. The gallery's open(payloadJson) parses it,
clamps against visibleSections (unknown names fall back to default),
and sets focusSection + selectedIndex inside the existing Qt.callLater
so the cursor's hasCursor bindings fire ensureCursorVisible
automatically.
This commit is contained in:
Ryan Hughes
2026-05-18 12:36:46 -04:00
parent b25dd100e3
commit d4bf8d0eea
2 changed files with 37 additions and 4 deletions
+16 -1
View File
@@ -1,5 +1,20 @@
#!/bin/bash
# omarchy:summary=Open the omarchy-shell dev gallery (qs.Ui kit preview)
# omarchy:args=[section]
# omarchy:examples=omarchy dev ui-preview | omarchy dev ui-preview button | omarchy dev ui-preview button-group | omarchy dev ui-preview slider
#
# Pass a section name to jump straight to that component instead of
# scrolling from the top. Section names match the cursor section ids in
# shell/plugins/dev-gallery/GalleryPanel.qml — `button`, `button-group`,
# `cursor-surface`, `slider`, `toggle`, `dropdown`, etc. Unknown names
# are ignored and the gallery opens at its normal default position.
omarchy-shell shell summon omarchy.dev-gallery '{}'
if [[ $# -gt 0 && -n $1 ]]; then
section="$1"
payload=$(printf '{"section":"%s"}' "${section//\"/}")
else
payload='{}'
fi
omarchy-shell shell summon omarchy.dev-gallery "$payload"