PJ/get_active_window.sh

29 lines
528 B
Bash
Raw Normal View History

2025-06-13 16:09:14 -07:00
#!/bin/bash
shopt -s nocasematch # ignore case for website titles
websites=("youtube" "youtube" "pbs")
### get active window
active="$(xdotool getactivewindow getwindowclassname)"
name="$(xdotool getactivewindow getwindowname)"
active="${active,,}"
case "$active" in
*"firefox" )
for ws in "${websites[@]}"; do
if [[ "$name" == *"$ws"* ]]; then
active+="_$ws"
break
fi
done
;;
*"steam")
if [[ "$name" == *"picture"* ]]; then
active+="_big"
else
active+="_little"
fi
;;
esac
echo "$active"