📜 ⬆️ ⬇️

The simplest reminder of bash dumplings

Since I was so lazy that I started brewing tea right in a mug, I started using the teatime applet. Already after the third day, the setting “Dumplings” started there. Of course, not the best solution, given the characteristics of the cooking process of this wonderful dish.
Since I too was too lazy to write an applet, I decided to jot down a tiny reminder script.

So, setting the problem


The essence of the task is extremely simple - two timers, one notifies about boiling water, the second - about the readiness of the dish. Notification is best accompanied by light effects for improved response.

Implementation



Sketch

The simplest option can be described as:

The notification itself consists of:

Training

Notification is done via notify-send . Text message command:
notify-send
To be sure, set the -t 10000 flag so that the message is held for 10 seconds.
The signal is given by the speaker with the beep command. Estets can edit the frequency and duration, but the default settings suit me.
The door opens and closes with the commands eject -r and eject -t
')
If there are no libraries, you can install them:
sudo apt-get install libnotify-bin beep

Code

Without further ado, let's take the simplest one given above. The only thing is we will put in a separate procedure all dances with notifications. We give her the text and the number of beeps / door openings.
 #!/bin/sh before_boil=8 after_boil=10 beep=true tray=true cry(){ notify-send -t 10000 "$2" "$3" i=$1 while [ $i -gt 0 ]; do if $beep; then beep; fi if $tray; then eject -r; eject -t; fi i=$(($i-1)) done } cry 0 " " "    .       " sleep ${before_boil}m cry 1 " " " ,  ,  .     -----" sleep ${after_boil}m cry 2 " " " , !" 

In the header of the configuration script:

All intervals measured on its plate, adjust if necessary.

Source: https://habr.com/ru/post/127523/


All Articles