Skip to content

Instantly share code, notes, and snippets.

@TimBozeman
Created May 19, 2014 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimBozeman/a1e743837fb322d6008a to your computer and use it in GitHub Desktop.
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
#!/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
@Illizian
Copy link

👍 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment