hex/scripts/test-wayland-paste.sh
Kit Langton 75f859bbfc
feat(ui): consolidate the desktop design system (#138)
* feat(ui): add design tokens and one shared component set

* style(ui): adopt the design system across the Settings window panes

* style(ui): adopt the design system in the picker, inputs, capsules, and Linux

* docs: add the design system guide and point agents to it

* fix(ui): keep truncated lines at their final width and restore the sparkle icon

* fix(ui): shape truncated lines at paint time against their final width

* feat(ui): add overflow-menu, detail-header, and baseline primitives

- Icon::Ellipsis, dropdown_menu, danger_menu_item, disabled_menu_item,
  and menu_separator for one reusable overflow menu
- detail_header / detail_title / detail_body: one fixed, edge-to-edge
  ruled header for every detail card
- list_section_label for group headings in list cards
- baseline_offset puts smaller text on a larger line's baseline
- MENU_WIDTH / MENU_OFFSET tokens; section labels inset to card text;
  pane_list centres its empty state

* feat(ui): meetings overflow menu, neutral recording button, polish pass

Meetings detail keeps Copy transcript and Rename visible and moves Copy
summary, Reveal, Summarize/Regenerate, and Delete… into a … menu. Delete
keeps its two-step confirmation in the action row; refusal rules are
unchanged. Stop & transcribe is a Secondary button with a red dot and
the elapsed time; the sidebar Update is Secondary with an accent dot.

Polish: shared detail headers in Meetings, History, and Commands;
timestamp and detail-row baselines; section labels on the card text
edge; wider side segments; transcript labels on the bubble text; one
menu width; Commands context moved into the detail; ... -> …; no
closing period on one-phrase descriptions.

Adds the --open-meeting-actions preview flag.

* docs: document the accent and overflow-menu rules

* fix(ui): history detail rows, delete confirmation row, side segments

- History metadata rows sit directly in the detail body so values keep
  the full width (they collapsed to one character per line)
- An armed meeting delete replaces the action row; actions wrap
- Left / Either / Right selector width follows its segment widths
- Ellipsis draws one icon size up to match the other glyphs optically

* fix(ui): detail rows wrap long values inside the detail body

* fix(ui): keep the detail body a block so detail rows wrap

* fix(ui): detail rows fill their column again

* refactor(ui): simplify design tokens, shared components, and meeting error banners
2026-10-18 16:59:43 -07:00

132 lines
4.9 KiB
Shell
Executable file

#!/usr/bin/env bash
set -euo pipefail
if [[ "${1:-}" == --inside ]]; then
target=
keyboard=
app=
service=
finish() {
status=$?
trap - EXIT
if [[ -n "$target" ]]; then kill "$target" 2>/dev/null || true; fi
if [[ -n "$keyboard" ]]; then kill "$keyboard" 2>/dev/null || true; fi
if [[ -n "$app" ]]; then kill "$app" 2>/dev/null || true; fi
if [[ -n "$service" ]]; then kill "$service" 2>/dev/null || true; wait "$service" 2>/dev/null || true; fi
printf '%s\n' "$status" > "$HEX_WAYLAND_TEST_RESULT"
swaymsg exit >/dev/null 2>&1 || true
exit "$status"
}
trap finish EXIT
# Seed the isolated compositor's keyboard state before any window exists.
wtype -k v -p VoidSymbol -s 60000 &
keyboard=$!
for ((attempt = 0; attempt < 100; attempt++)); do
if swaymsg -t get_inputs -r | grep -q wlr_virtual_keyboard; then break; fi
sleep 0.05
done
"$HEX_WAYLAND_TEST_TARGET" "$HEX_WAYLAND_PASTE_OUTPUT" &
target=$!
for ((attempt = 0; attempt < 100; attempt++)); do
if [[ -f "$HEX_WAYLAND_PASTE_OUTPUT.ready" ]]; then break; fi
sleep 0.05
done
test -f "$HEX_WAYLAND_PASTE_OUTPUT.ready"
"$HEX_WAYLAND_TEST_BINARY" --exact linux_paste::tests::native_wayland_clipboard_shortcut \
--ignored --nocapture --test-threads=1
kill "$target"
wait "$target" 2>/dev/null || true
target=
# The app-window check uses compositor IPC, not keyboard input. Remove the
# synthetic seat first rather than expose a transient, keymap-less keyboard.
kill "$keyboard"
wait "$keyboard" 2>/dev/null || true
keyboard=
for ((attempt = 0; attempt < 100; attempt++)); do
if ! swaymsg -t get_inputs -r | grep wlr_virtual_keyboard >/dev/null; then break; fi
sleep 0.05
done
"$HEX_WAYLAND_APP_BINARY" service >"$HEX_WAYLAND_APP_LOG.service" 2>&1 &
service=$!
for ((attempt = 0; attempt < 100; attempt++)); do
if "$HEX_WAYLAND_APP_BINARY" status >/dev/null 2>&1; then break; fi
sleep 0.05
done
"$HEX_WAYLAND_APP_BINARY" status >/dev/null
"$HEX_WAYLAND_APP_BINARY" app >"$HEX_WAYLAND_APP_LOG" 2>&1 &
app=$!
for ((attempt = 0; attempt < 200; attempt++)); do
kill -0 "$app"
if swaymsg -t get_tree -r | grep '"name": "Hex"' >/dev/null; then break; fi
sleep 0.05
done
swaymsg -t get_tree -r | grep '"name": "Hex"' >/dev/null
# Keep GPUI connected while the paste helper creates a virtual keyboard.
export HEX_WAYLAND_PASTE_OUTPUT="$HEX_WAYLAND_PASTE_OUTPUT-coexist"
"$HEX_WAYLAND_TEST_TARGET" "$HEX_WAYLAND_PASTE_OUTPUT" &
target=$!
for ((attempt = 0; attempt < 100; attempt++)); do
if swaymsg -t get_tree -r | grep '"name": "Hex Wayland Test"' >/dev/null; then break; fi
sleep 0.05
done
swaymsg -t get_tree -r | grep '"name": "Hex Wayland Test"' >/dev/null
wtype -p v -p VoidSymbol -s 60000 &
keyboard=$!
for ((attempt = 0; attempt < 100; attempt++)); do
if [[ -f "$HEX_WAYLAND_PASTE_OUTPUT.ready" ]]; then break; fi
sleep 0.05
done
test -f "$HEX_WAYLAND_PASTE_OUTPUT.ready"
"$HEX_WAYLAND_TEST_BINARY" --exact linux_paste::tests::native_wayland_clipboard_shortcut \
--ignored --nocapture --test-threads=1
kill -0 "$app"
kill "$target"
wait "$target" 2>/dev/null || true
target=
swaymsg '[app_id="hex"] kill' >/dev/null
wait "$app"
app=
kill -0 "$service"
"$HEX_WAYLAND_APP_BINARY" status >/dev/null
exit 0
fi
if [[ $# != 2 || $(id -u) == 0 ]]; then
echo "Usage: $0 /path/to/compiled-test /path/to/voice-control (run as an unprivileged user)" >&2
exit 1
fi
for command in cc pkg-config sway swaymsg wtype wl-copy dbus-run-session timeout; do
command -v "$command" >/dev/null
done
root=$(cd -- "$(dirname -- "$0")/.." && pwd)
work=$(mktemp -d)
trap 'rm -rf -- "$work"' EXIT
export HEX_WAYLAND_TEST_BINARY
HEX_WAYLAND_TEST_BINARY=$(realpath -- "$1")
export HEX_WAYLAND_APP_BINARY
HEX_WAYLAND_APP_BINARY=$(realpath -- "$2")
export HEX_WAYLAND_TEST_SCRIPT="$root/scripts/test-wayland-paste.sh"
export HEX_WAYLAND_TEST_TARGET="$work/target"
export HEX_WAYLAND_PASTE_OUTPUT="$work/pasted.txt"
export HEX_WAYLAND_TEST_RESULT="$work/result"
export HEX_WAYLAND_APP_LOG="$work/hex.log"
export XDG_RUNTIME_DIR="$work/runtime"
export XDG_DATA_HOME="$work/data"
export HEX_APPLICATION_SUPPORT_DIR="$work/support"
export ALSA_CONFIG_PATH="$work/alsa.conf"
printf '# No physical audio devices in this fixture.\n' > "$ALSA_CONFIG_PATH"
mkdir -m 700 "$XDG_RUNTIME_DIR"
cc "$root/tests/fixtures/wayland-paste-target.c" $(pkg-config --cflags --libs gtk+-3.0) -o "$HEX_WAYLAND_TEST_TARGET"
unset DISPLAY WAYLAND_DISPLAY SWAYSOCK
export WLR_BACKENDS=headless WLR_RENDERER=pixman WLR_LIBINPUT_NO_DEVICES=1 GDK_BACKEND=wayland
if ! timeout 25 dbus-run-session -- sway --config "$root/tests/fixtures/wayland-paste.conf" >"$work/compositor.log" 2>&1 \
|| [[ ! -f "$work/result" || $(<"$work/result") != 0 ]]; then
cat "$work/compositor.log"
if [[ -f "$work/hex.log" ]]; then cat "$work/hex.log"; fi
exit 1
fi
echo "Native Wayland clipboard insertion and independent Settings/service checks passed."