Crmgo Blog

Bash, logging active window titles

Bash, logging active window titles

Bash, logging active window titles
$oldtitle=""
while true;do
title=$( xwininfo -id `xdpyinfo | sed -ne 's/^focus:.*\(0x[^,]\+\).*/\1/p'`| sed -ne 's/xwininfo: .*"\([^"]\+\)"/\1/p')
echo $title
#if [ $oldtitle !== $title ]
#oldtitle=$title
#then
echo $(date +%Y%m%d%H%M) $title >> log.log
#fi
sleep 5
done

 

Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.