mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-06 04:20:23 +00:00
* fix: change uwsm app to uwsm-app for performance * Do not run uwsm-app in parallel as it's not supported * Fix comment --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
17 lines
506 B
Bash
Executable File
17 lines
506 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|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 $LAUNCH_COMMAND
|
|
fi
|