PJ/find_or_open.sh

12 lines
264 B
Bash
Raw Normal View History

2025-06-13 16:09:14 -07:00
#!/bin/bash
helper_find_or_open(){
windows=$(wmctrl -l)
if [[ "${windows,,}" == *"$1"* ]]; then
xdotool windowactivate "$(wmctrl -l | grep -i "$1" | cut -d " " -f 1)"
echo "found $1"
else
nohup "$1" >/dev/null 2>&1 &
echo "opening $1"
fi
}