Skip to content

Instantly share code, notes, and snippets.

@tastytea
Last active September 11, 2017 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tastytea/7bf78dbe7d7950bdf555ccc16d9cf93f to your computer and use it in GitHub Desktop.
Save tastytea/7bf78dbe7d7950bdf555ccc16d9cf93f to your computer and use it in GitHub Desktop.
Display time in window title
#!/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