I have a small python script that I start it using a shell script stored in "/etc/X11/Xsession.d"

The code is very simple it show a notification message

import os
import time

while True:
      os.system('notify-send -i "/opt/say/logo.png" "Title" "Message"')

The code simply shows a notification message every 30 seconds. It works on Ubuntu 12.04 with no problem, but it does not work on Ubuntu 14.04. The shell script in "/etc/X11/Xsession.d" run as a root and as result my python code run with root privileges. I do not really want root privileges. All I want is to be able to see the notification.

1 Answer 1


You should send the notify message as the normal main user of your system, (ususally ID 1000):

MAINUSER=$(cat /etc/passwd|grep 1000|sed "s/:.*$//g")
su $MAINUSER -c $"notify-send -i \"/opt/say/logo.png\" \"Title\" \"Message\""

(not sure, how to call it like this in your python script, but I hope it helps)

You must log in to answer this question.

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