15 lines
614 B
Bash
15 lines
614 B
Bash
#!/usr/bin/env bash
|
|
# Source inside the headless rig; accepts a key and an optional modifier.
|
|
rig_key() {
|
|
local key="$1" modifier="${2:-}"
|
|
# Destroying rig-pointer's virtual seat can clear keyboard focus in Sway.
|
|
swaymsg '[app_id="dev.clipbin.Clipbin"] focus' >/dev/null
|
|
sleep .2
|
|
# Let the virtual keymap settle, then hold the key through a UI dispatch.
|
|
local args=(-s 200)
|
|
if [[ -n "${modifier}" ]]; then args+=(-M "${modifier}" -s 100); fi
|
|
args+=(-P "${key}" -s 100 -p "${key}")
|
|
if [[ -n "${modifier}" ]]; then args+=(-m "${modifier}"); fi
|
|
timeout 10 wtype "${args[@]}"
|
|
}
|