hex/.github/workflows/check-linux.yml
Dax Raad 1577c19b52 feat(linux): portal shortcuts and hex commands replace raw Wayland input
Wayland shortcuts no longer read /dev/input. One state machine in
linux_input now serves every source:

- X11: the existing key grabs, with auto-repeat filtering split out and
  tested, and the inline gesture flags replaced by the shared rules.
- Wayland with the GlobalShortcuts portal: Register("hex"), one session for
  dictation, Paste Last, and Voice Action, and a second session that binds
  Escape (also with the held shortcut's modifiers) only while recording.
  Activated/Deactivated are press/release; refused shortcuts and the
  trigger the desktop actually granted show in Settings; a closed session
  cancels and stops the listener with an error.
- Everywhere: `hex dictation start|stop|toggle|cancel`,
  `hex voice-action start|stop|toggle`, and `hex paste-last` talk to the
  running service over its socket for desktops without the portal. They
  are idempotent, never start the service, and fail clearly when it is
  missing or not listening.

Settings records shortcuts from its own key events on Wayland too, lists
the granted triggers, or, without the portal, hides the shortcut rows and
lists the commands. Wayland paste no longer waits for held modifiers:
wtype's virtual keyboard sends its own, and the Wayland paste smoke now
pastes while another keyboard holds Ctrl and Alt.

Removes linux_wayland_input.rs, the evdev and udev crates, libudev-dev in
CI, and every input-group requirement from the docs. Also gates
AppWindowPreview::pane to macOS, whose only callers broke the Linux
Clippy build.
2026-10-22 01:13:07 -04:00

139 lines
5.2 KiB
YAML

name: Check Linux
on:
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "build.rs"
- "src/**"
- "native/**"
- "macos/HexMicrophoneDriver/Info.plist"
- "resources/**"
- "assets/**"
- "tests/**"
- "scripts/test-wayland-paste.sh"
- "scripts/test-linux-dictation.sh"
- "scripts/test-linux-service.py"
- "scripts/*install-linux*.sh"
- "flake.*"
- "nix/**"
- ".github/workflows/check-linux.yml"
push:
branches: [main]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "build.rs"
- "src/**"
- "native/**"
- "macos/HexMicrophoneDriver/Info.plist"
- "resources/**"
- "assets/**"
- "tests/**"
- "scripts/test-wayland-paste.sh"
- "scripts/test-linux-dictation.sh"
- "scripts/test-linux-service.py"
- "scripts/*install-linux*.sh"
- "flake.*"
- "nix/**"
- ".github/workflows/check-linux.yml"
permissions:
contents: read
concurrency:
group: linux-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
CARGO_BUILD_JOBS: "2"
CARGO_PROFILE_DEV_DEBUG: "0"
SOURCE_DATE_EPOCH: "0"
BLA_VENDOR: OpenBLAS
OPENSSL_NO_VENDOR: "1"
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install native libraries
run: |
sudo apt-get update
sudo apt-get install -y clang cmake pkg-config python3 libasound2-dev \
libssl-dev libgtk-3-dev libgtk-layer-shell-dev libayatana-appindicator3-dev \
libxkbcommon-x11-dev libx11-xcb-dev libfontconfig1-dev libfreetype-dev \
libxcursor-dev libxi-dev libxrandr-dev libopenblas-dev libvulkan-dev \
glslc libshaderc-dev xvfb xauth x11-xserver-utils \
sway wl-clipboard wtype dbus-x11 jq mesa-vulkan-drivers \
pulseaudio pulseaudio-utils libasound2-plugins xdotool
- run: cargo fmt --all --check
- run: cargo test --locked --bin voice-control
- name: Exercise X11 grabs on an isolated display
run: |
xvfb-run -a --server-args="-screen 0 1280x900x24 -noreset" sh -c '
xmodmap -e "keycode 191 = F24"
cargo test --locked --bin voice-control linux_input::tests -- --ignored --test-threads=1
'
- name: Exercise native Wayland paste into GTK
run: |
binary=$(cargo test --locked --bin voice-control --no-run --message-format=json |
jq -r 'select(.reason == "compiler-artifact" and .profile.test == true and .target.name == "voice-control") | .executable // empty')
app=$(cargo build --locked --bin voice-control --message-format=json |
jq -r 'select(.reason == "compiler-artifact" and .target.name == "voice-control") | .executable // empty')
scripts/test-wayland-paste.sh "$binary" "$app"
- uses: actions/cache@v6
with:
path: ${{ runner.temp }}/hex-model-test/models
key: linux-dictation-model-${{ hashFiles('src/transcription_models.rs') }}
- name: Exercise capture, inference, and paste through a virtual microphone
env:
HEX_APPLICATION_SUPPORT_DIR: ${{ runner.temp }}/hex-model-test
run: |
target/debug/voice-control model install
curl --fail --location --silent --show-error --max-time 60 \
https://raw.githubusercontent.com/ggml-org/whisper.cpp/b0a11594aec50892a02cd8d129eee2dfe93a8bb8/samples/jfk.wav \
--output "$RUNNER_TEMP/jfk.wav"
printf '%s %s\n' \
59dfb9a4acb36fe2a2affc14bacbee2920ff435cb13cc314a08c13f66ba7860e \
"$RUNNER_TEMP/jfk.wav" | sha256sum --check
scripts/test-linux-dictation.sh target/debug/voice-control \
"$HEX_APPLICATION_SUPPORT_DIR/models/parakeet-unified-en-0.6b-Q8_0.gguf" \
"$RUNNER_TEMP/jfk.wav"
- name: Exercise signed installer and tamper rejection
run: scripts/test-install-linux-release.sh
- name: Exercise service IPC and client-independent lifecycle
run: python3 scripts/test-linux-service.py target/debug/voice-control
- run: cargo clippy --locked --bin voice-control --tests -- -D warnings
nix:
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v7
- uses: cachix/install-nix-action@v31
- uses: DeterminateSystems/magic-nix-cache-action@v15
with:
use-gha-cache: enabled
use-flakehub: disabled
diagnostic-endpoint: ""
- run: nix flake check --all-systems --no-build
- name: Check packaging configuration and session readiness
run: |
nix build --no-link \
.#checks.x86_64-linux.shell-environment \
.#checks.x86_64-linux.modules \
.#checks.x86_64-linux.session-readiness
- name: Build and test the installed Nix package
run: |
nix build --no-link --print-build-logs --max-jobs 1 --cores 1 \
.#checks.x86_64-linux.package