How to use cron to display messages on the screen via notify-send

cronnotifications

I am toying around with notify-send and cron (on an Arch machine) and I can't figure out a way to combine them:

I tried the solution given here and here, but neither worked. How can I use them?

EDIT:
I have set the DISPLAY in the crontab and it still didn't work. I tried the same in Ubuntu and there things are working fine. Here is my cron line:

*/1 * * * * DISPLAY=:0.0 /usr/bin/notify-send "hellp" || echo "er" > .er

Best Answer

About the only thing that I can suggest is to create a named pipe and have cron write to the pipe and have a little script started by the session manager that reads from the pipe and calls notify-send:

while read line < /tmp/.cron2notify.s  # pipe name in /tmp
do notify-send "Cron message" "$line"
done

Then in the crontab, have the program write to /tmp/.cron2notify.s.

Haven't tested this, but should give you a starting point to work from.

Related Question