Created
April 14, 2011 20:24
-
-
Save jclaggett/920415 to your computer and use it in GitHub Desktop.
context switcher tool
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 -e | |
status_icon_000="/usr/share/icons/Humanity/apps/48/stock_delete-bookmark.svg" | |
status_icon_100="/usr/share/icons/Humanity/apps/48/stock_bookmark.svg" | |
function context_loop() { | |
declare time_task | |
while time_task=$(context_switch_dialog $*) | |
do | |
set $time_task # reference using positional args | |
declare -i i=1+$1 | |
echo "icon:$status_icon_000" | |
while ((--i>0)) | |
do | |
echo "tooltip:Working on ${*:2} ($i minute$(s $i) left)" | |
sleep 60 | |
done | |
echo "icon:$status_icon_100" | |
echo "tooltip:Working on ${*:2} ($i minute$(s $i) left)" | |
echo "message:Your $1 minute$(s $1) for working on ${*:2} are spent." | |
done | context_notification | |
} | |
function context_switch_dialog() { | |
zenity \ | |
--entry \ | |
--title='Context Switcher' \ | |
--text='Please enter minutes and title for your next task:' \ | |
--entry-text="$*" | |
} | |
function context_notification() { | |
zenity \ | |
--notification \ | |
--listen \ | |
--text="Context Switcher" \ | |
--window-icon="$status_icon_100" | |
} | |
function s() { | |
(($1!=1)) && echo s | |
} | |
context_loop ${*:-5 sample task} |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment