Tomato clock!

Just a simple script that reminds you to take some rest every n minutes

optional assets:

  • some nice soundfx
  • a potato logo (here ~/utils/tomato.png)

tomato

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/bash

# default; time in minutes
INTERVAL=40
BREAK=5
function print_help {
    echo "USAGE $0 [opts]"
    echo "options"
    echo "-i/--interval [num] duration of each work cycle, default 40"
    echo "-b/--break [num] duration of a break, default 5"
}

re='^[0-9]+$'
while [[ $# -gt 0 ]]; do
  case $1 in
    -i|--interval)
      if ! [[ $2 =~ $re ]] ; then
        echo "invalid input" >&2; print_help; exit 1
      fi
      INTERVAL="$2"
      shift # past argument
      shift # past value
      ;;
    -b|--break)
      if ! [[ $2 =~ $re ]] ; then
        echo "invalid input" >&2; print_help; exit 1
      fi
      BREAK="$2"
      shift # past argument
      shift # past value
      ;;
    -*|--*)
      print_help
      exit 1
      ;;
    *)
      POSITIONAL_ARGS+=("$1") # save positional arg
      shift # past argument
      ;;
  esac
done

let "SLEEP = $INTERVAL * 60"
let "SLEEPW = $BREAK * 60"
notify-send "timer set! next break in $INTERVAL minutes, break time $BREAK minutes  " --app-name="Tomato Timer" -i ~/utils/tomato.png

sleep $SLEEP

while true
do
    notify-send -u critical "$INTERVAL minutes elapsed, relax!  " --app-name="Tomato Timer" -i ~/utils/tomato.png
    sleep $SLEEPW
    notify-send "timer set! \n next break in $INTERVAL minutes  " --app-name="Tomato Timer" -i ~/utils/tomato.png
    sleep $SLEEP
done


[+] click to leave a comment [+]
the comment system on this blog works via email. The button
below will generate a mailto: link based on this page's url 
and invoke your email client - please edit the comment there!

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as   
  anonymous
- your email address will not be disclosed
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.

>> SEND COMMENT <<




Fun with Image Maps and SVGs via benji February 20, 2024

Over the past few weeks I've been playing around with making some images on my website interactive. My "informatics" class in high school taught us some basic HTML. By basic I mean in notepad and writing everything by hand, saving to a...

Goblin Week 2024 via Helvetica Blanc January 26, 2024

It snuck up on me, but I managed to draw my little goblins to celebrate the week! I love my children - they're like awful Pikmin. I've uploaded the whole parade as a print, as well as individual prints for each goblin. There's something very fu…

How to trust gpg keys via Travis Shears Personal Site October 27, 2023

After moving some GPG keys to a new computer I kept getting these trust warnings. It is NOT certain that the key belongs to the person named in the user ID.If you * really * know what you are doing, you may answer the next question with yes. Use this key a…

Generated by openring from webring