Stupidly simple Linux reminders
Programmers tend to be a forget folk. I know I certainly get lost in thought when I'm in the zone. This makes reminders and alarms a necessity. Some people simply plug these into their phones, I prefer them on my computer.
So, what's the simplest and most flexible way to do that in Linux? Cron.
Let's first find out where notify-send lies on your system. This will help us avoid bugs. By the way, I've tested notify-send on gnome and KDE, it may or may not work on other desktop environments. To get the full path to notify-send, run this command and save the path somewhere:
whereis notify-send
If you don't know the cron syntax by heart I recommend you head on over to https://crontab.guru. After you've defined how often you want to run your notification you open up your crontab with:
crontab -e
Now simply enter your previously generated line. Next we have to define a variable so that notify-send knows where to send the notification to. Followed by the full path to notify-send and lastly the title and message that you want to display. Let's say you want a daily reminder to have tea at 20:30, this could be your crontab entry:
30 20 * * * XDG_RUNTIME_DIR=/run/user/$(id -u) /usr/bin/notify-send Reminder "It's tea time."
If that's too bland for you, you can spice it up by passing arguments to notify-send. The -u flag can be used to define the urgency of your notification, -t can be used to set the notification timeout and -i can be used to pass a path to an image that will be used as an icon. Just have a look at:
man notify-send