Created
May 19, 2014 20:34
-
-
Save TimBozeman/a1e743837fb322d6008a to your computer and use it in GitHub Desktop.
A script you can bind to a hotkey that toggles the Hamster Time Tracker window
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/bash | |
# @File Switch between current window and Hamster Time Tracker | |
# get current window | |
hamster="Time Tracker" | |
currentWindow=$(xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) _NET_WM_NAME|cut -d'"' -f2) | |
if [ "${currentWindow}" != "$hamster" ] | |
# write the title of the current window to a file and switch to hamster | |
then echo "${currentWindow}" > /tmp/hamster.dat && wmctrl -Fa "$hamster" | |
# read window temp file and switch to it | |
else lastWindow=`cat /tmp/hamster.dat` && wmctrl -Fa "$lastWindow" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍 thanks!