Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

Egg Timer

# Filename:
# Version: 220111
# Author: robz
# Another timer! Why? Answer: eggs hard boiled for 2 hours, if you can stomach
# the smell you don't need this timer!
# This one has an indication of time remaining provided by Zenity's GUI.
# As usual you'll need your own sound and icon for the variables below.


COUNT=$(zenity --title "Egg Timer" --window-icon $ICON --text "No decimals"\
    --entry-text "eg. 10s or 5m or 2h" --entry)
if [ $? = 1 ]; then exit $?
elif [[ $COUNT = "eg. 10s or 5m or 2h" || $COUNT = "" || $COUNT -eq $COUNT ]]
    then zenity --error --text "<b>Use the form of\n10s or 5m or 2h\
    \nNo decimals</b>"

    exit 1

case "${COUNT: -1}" in
    "S" | "s" ) COUNT=$(echo $COUNT | sed -s "s/[Ss]//") ;;
    "M" | "m" ) COUNT=$(echo $COUNT | sed -s "s/[Mm]//"); ((COUNT*=60)) ;;
    "H" | "h" ) COUNT=$(echo $COUNT | sed -s "s/[Hh]//"); ((COUNT*=3600)) ;;
    *) exit

until [ "$COUNT" -eq "0" ]; do
    echo "#\t\t$COUNT seconds to go.\t\t"
    sleep 1
done | zenity --title "Egg Timer" --progress --pulsate --text=""\
    --window-icon=$ICON --auto-close
if [ $? = 1 ]; then exit $?; fi

notify-send -i $ICON "Egg Timer > ## TIMES UP ##"
/usr/bin/canberra-gtk-play --volume 6 -f $SOUND
zenity --notification --text "Egg Timer > ## TIMES UP ##"

No comments: