Skip to content

Instantly share code, notes, and snippets.

@jjrh
Created August 28, 2013 18:50
Show Gist options
  • Save jjrh/6369771 to your computer and use it in GitHub Desktop.
Save jjrh/6369771 to your computer and use it in GitHub Desktop.
I tend to forget to log my time, then I tend to forget what I did and for how long. The idea of this is to have a popup on my screen every hour that displays a text box and asks me what I did. I enter a short line saying what I was doing.
#!/bin/sh
DISPLAY=:0
export DISPLAY
prompt_dialog ()
{
text=$(zenity --text-info --title="what have you been working on?" --editable)
length=${#text}
if [ $length -lt 1 ]
then
$(zenity --question --text="you entered nothing. Have you been doing nothing?")
case $? in
0)
echo "0"
return;;
esac
prompt_dialog
else
# do it here becuase if I lag or went out for lunch / left early I can get a accurate date
full_date=$(date +%F)
time_log_file=/home/jjrh/hour_logs/$full_date
d=$(date)
echo $d | cut -f4 -d ' ' >> $time_log_file
echo $text >> $time_log_file
echo "----------" >> $time_log_file
fi
}
prompt_dialog
# crontab ......
# m h dom mon dow
# 1 9-17 * * * /home/jjrh/scripts/hour_log_pest
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment