Files
omarchy/bin/omarchy-launch-or-focus
v-oleg e4ca98301b Add focus or launch script (#925)
* Add focus or launch script

* Replace eval with exec

* Use eval so it properly expands the variables

* Apply to the apps where it makes most sense

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
2025-09-14 21:58:08 +02:00

17 lines
460 B
Bash
Executable File

#!/bin/bash
if (($# == 0)); then
echo "Usage: omarchy-launch-or-focus [window-pattern] [launch-command]"
exit 1
fi
WINDOW_PATTERN="$1"
LAUNCH_COMMAND="${2:-"uwsm app -- $WINDOW_PATTERN"}"
WINDOW_ADDRESS=$(hyprctl clients -j | jq -r --arg p "$WINDOW_PATTERN" '.[]|select((.class+" "+.title)|test($p;"i"))|.address' | head -n1)
if [[ -n $WINDOW_ADDRESS ]]; then
hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
else
eval exec $LAUNCH_COMMAND
fi