Hi,% username%.
To organize my work, it is convenient to see or hear notifications that an hour has passed, half an hour, etc. I need this for orientation in the temporary space and proper planning of my work.
Since I own Ubuntu, the article will be about how to make such notifications using standard Ubuntu tools.

So, I need:
- every hour to see and hear the notice of time
- the notice should not distract
- the solution should be easy and economical in terms of resources
In the process of searching I tried several applications. Some of them were not bad, but without the functionality I needed, some were terribly inconvenient, and something didn’t work at all. Almost all programs suffered greatly reliability.
I did not find a normal tool, and therefore I decided to implement it myself. Writing your program is a long time, and therefore it is easier to make a script on your lap.
Ubuntu notifications
As you know, notify
-send is used for notifications in Ubuntu. In the latest versions of Ubuntu, notify-send is used as the primary notification tool. It really is very convenient when all messages are displayed monotonously. Use it like this:
$ notify-send title message
By running this simple command in the console, after some time you will see a notification with the title and message. It looks like this to me:

Great, we already know how to display messages, it remains to learn how to show them on a schedule.
')
Scheduled tasks in linux
For scheduled tasks there is an excellent
crontab tool in linux
crontab -e
the editor comes off, we drive a line into it:
0 */1 * * * DISPLAY=:0.0 notify-send "" " 1 "
Save, admire the result. If you want to play, then you can put the notification once a minute, then the debug entry will look something like this:
*/1 * * * * DISPLAY=:0.0 notify-send "" " 1 "
Now at regular intervals we can output something to the user:

For users who can not configure crontab I can advise online generator. For example,
such .
I note separately that I did not bother with the definition of the display number. Yes, it can change, but after several months of work with me, it has never changed, because I still have a desktop, and the script is still done on the knee.
I will share another recipe. Using crontab -e is not very convenient, since The default editor opens. Usually it is nano. I think he's terrible. I usually do this:
crontab -l > /tmp/crontab.file && cp /tmp/crontab.file /tmp/crontab.file.backup && gedit /tmp/crontab.file && crontab /tmp/crontab.file
The file opens in a convenient gedit, edited, saved or not saved. After closing the gedit window, the settings go to crontab.
Or make out the whole thing in the script and put, for example, on the desktop:
Dialogs in linux scripts
Now, part of the problem has been resolved. But only partially, because I don’t always look at the monitor screen and can skip the message. The zenity utility came to my aid. She was already in the system. Write boldly in crontab
0 */1 * * * DISPLAY=:0.0 zenity --info --title="" --text=" "
or debug entry:
*/1 * * * * DISPLAY=:0.0 zenity --info --title="" --text=" "
The result was something like this:

For some time it was convenient to work, but over time the notification window began to get me. This fact made me upgrade my cron scripts. As a result, I came across the 3rd useful utility:
ESpeak .
It allows you to synthesize voice messages in different languages.
Add a new line to crontab:
0 */1 * * * espeak -vru -s130 " 1 "
or debug line
*/5 * * * * espeak -vru -s130 " 5 "
In the end, that's what happened
The speech synthesizer spoke Russian horribly. It was disgusting to listen, and so I switched to English and made some other improvements:
- made the watchmaker say time
- added reminders to drink coffee.
The final functionality of the notifications completely suited me. I did not have to put anything, everything was lightweight and reliable.
My crontab now looks like this:
And the hours.sh file:
I rendered the scripts in the hours.sh file due to the fact that the crontab script does not support processing the
typewritten inverse apostrophe . If you specify a typewritten reverse apostrophe in crontab, the script will not work at the specified time.
Well, at the end of the screenshots of how it looks from me.
Every hour a message is displayed for how long:

The message is duplicated by sound. If I'm near the computer, I'll hear it. And twice a day I’m sent a reminder that I still need to take a break.
UPD: Improved the script based on tips and comments.
Special thanks to
lionsimba for
commenting about the festival .
As a result, the new version of hours.sh has turned out
The script quite reasonably reports in Russian about the time.
That's all, thank you for your attention.