2022-09-25 03:21:33 -04:00
|
|
|
#!/bin/bash
|
|
|
|
# Adapted from the bash snippet found at:
|
|
|
|
# https://bbs.archlinux.org/viewtopic.php?id=117031
|
|
|
|
|
2022-10-06 11:54:24 -04:00
|
|
|
# Wait for the application to start
|
|
|
|
while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
|
|
|
|
sleep 0.05
|
|
|
|
done
|
|
|
|
|
|
|
|
# Read so long as the application is running
|
|
|
|
while pgrep -u "$USER" ^$1 &> /dev/null ; do
|
2022-12-08 00:47:02 -05:00
|
|
|
sleep 0.05
|
|
|
|
if [[ -f ~/.agmsilent ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-09-25 03:21:33 -04:00
|
|
|
wnd_focus=$(xdotool getwindowfocus)
|
|
|
|
wnd_title=$(xprop -id $wnd_focus WM_NAME)
|
|
|
|
lookfor='"(.*)"'
|
|
|
|
|
|
|
|
if [[ "$wnd_title" =~ $lookfor ]]; then
|
|
|
|
wnd_title=${BASH_REMATCH[1]}
|
|
|
|
if [[ "$old_title" != "$wnd_title" ]]; then
|
2022-10-07 05:30:01 -04:00
|
|
|
spd-say -- "$wnd_title"
|
2022-09-25 03:21:33 -04:00
|
|
|
old_title="$wnd_title"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2022-12-08 00:47:02 -05:00
|
|
|
|
|
|
|
exit 0
|