2

I'm making a small script in which I make several calls to Zenity. Executing the script manually or executing the commands from the terminal works properly. However, when I run them from Cron they give me problems. To test it, I have put in crontab two commands:

export DISPLAY=:0 && zenity --info --text "Window test"
export DISPLAY=:0 && zenity --notification --text "Notification test"

The first command shows an independent notification window with no problem, but the second one, which should show me a floating system tray notification, does not show anything at all only when I run it from crontab.

What can I do to make zenity --notification work from crontab if it works without any problem from another non-graphical TTY?

My system is KDE-Neon 5.19 with Ubuntu 20.04 and Plasma desktop 5.19.4. The version of Zenity is 3.32.0.

1

2 Answers 2

2

I added this to my user's crontab; this has been tested with python (notify2 library) and zenity:

DISPLAY=":0.0"
XAUTHORITY="/home/my_username/.Xauthority"
XDG_RUNTIME_DIR="/run/user/1000"
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
0
0

To me was enough just adding to the top of my script:

export DISPLAY=:0
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus

Thanks a lot!!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .