mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
* Add omarchy CLI * Remove outdated or internal * Add bash completions for command * Add omarchy command documentation * Add missing docs * Correct to what's now right * Fix tests --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
20 lines
642 B
Bash
Executable File
20 lines
642 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Launch an app or focus an existing window matching a pattern
|
|
# omarchy:args=<window-pattern> <launch-command>
|
|
|
|
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|test("\\b" + $p + "\\b";"i")) or (.title|test("\\b" + $p + "\\b";"i")))|.address' | head -n1)
|
|
|
|
if [[ -n $WINDOW_ADDRESS ]]; then
|
|
hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
|
|
else
|
|
eval exec setsid $LAUNCH_COMMAND
|
|
fi
|