Last active
September 11, 2017 00:59
-
-
Save tastytea/7bf78dbe7d7950bdf555ccc16d9cf93f to your computer and use it in GitHub Desktop.
Display time in window title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "${1}" ]; then | |
echo "usage: ${0} <Window Title>" >&2 | |
exit 1 | |
fi | |
WINTITLE="${1}" | |
WINID=$(wmctrl -l | grep ${WINTITLE} | cut -d' ' -f1) | |
if [ -z "${WINID}" ]; then | |
echo "Window not found" >&2 | |
exit 2 | |
fi | |
trap "wmctrl -i -r ${WINID} -N \"${WINTITLE}\"" EXIT | |
while wmctrl -i -r ${WINID} -N "${WINTITLE} – $(date +'%R')"; do | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment