yabai-config/scripts/windowFocusOnDestroy.sh

8 lines
295 B
Bash
Raw Permalink Normal View History

2023-03-06 01:24:40 +08:00
#!/bin/dash
isFocused=$(yabai -m query --windows --window | jq -re ".id")
echo $isFocused
if [[ -z "$isFocused" ]]; then # -z >> true if it's null
$(yabai -m window --focus $(yabai -m query --windows | jq -re ".[] | select((.visible == 1) and .focused != 1).id" | head -n 1))
echo hi
fi