I am monitoring my computer screen time usage and I often find myself running uptime --pretty
and I would like to find out a better way. My goal is to to wrap my work up within 2 hours of sitting at the computer. My ideas are to have a program launch at first boot login, then at the 1.5 hr or 2 hr mark set off a notification on my notification tray so that I may save my work and logout/poweroff. I know how to set programs to launch at startup via startup applications however clueless how to fire notifications. I am using 20.04 on Gnome.
Asked
Active
Viewed 1,255 times
4
1 Answers
6
Use the
sleep
command withh
(hours) like so:sleep 2h
With the
notify-send
command like so:notify-send "Please wrap up your work."
Both in a
sh
command stringsh -c '...'
like so:sh -c 'sleep 2h; notify-send "Please wrap up your work."'
Then, add a new startup application and paste the above
sh
command string in the command field like so:Then, save it.
Next time you login and thereafter, you will be notified after two hours of login.

Raffa
- 32,237
-
Amazing. This looks like just the thing I need. However I am concerned about
sleep
using CPU cycles. Does it? If yes, is there a way to callnotify-send
at a specific time ? – Weezy Jun 12 '22 at 16:57 -
2@Weezy No, it doesn't …. Actually, it’s the most CPU efficient method in your use case … please see https://askubuntu.com/a/524918 and https://stackoverflow.com/a/51279647 – Raffa Jun 12 '22 at 17:08
login
instead ofboot
. How do I make a notification and which language has the best support? – Weezy Jun 12 '22 at 12:06