Try this (needs wmctrl)- I set it to run every minute in cron (note username in cron line):
Code:
#get dispay of user - 1st check is not xrdp/vnc user
dpl=`ps aux | grep -i Xvn | grep $1 | grep -v grep | cut -c71-73 | sed -e 's/ *$//'`
#if not found default to display 0
if [ -z $dpl ] ; then
dpl=":0"
fi
export DISPLAY=$dpl #set display
for i in {0..11} ;
do
for pid in `wmctrl -p -l | grep -i unread | cut -c 15-21` ; #look for pid of processes with unread in title
do
if [ `ps -p $pid -o comm=` == "empathy" ] ; then #if process is empathy
wmctrl -i -a `wmctrl -lp | grep unread | grep $pid | cut -c1-10` #bring to front
fi
done
sleep 5 #run check for unread messages every 5 seconds
done
crontab line:
*/1 * * * * bash /usr/bin/unread.sh [USERNAME OF ACCOUNT TO CHECK]
e.g.
*/1 * * * * bash /usr/bin/unread.sh david
Bookmarks