I have a simple Python script here:

#! /usr/bin/python
import os

os.system('notify-send Hello "This is a message"')

When I, as a normal user, run the script in terminal as ./notification.py, a desktop notification is displayed on the screen with the contents Hello This is a message. However, when I (normal user) run sudo ./notification.py, no desktop notification is shown. I am unable to understand this behaviour and how to go about solving it or working around it.


OS - OpenSUSE Leap 42.1

DE - KDE Plasma v5.5.5


It won't show this message. Running with sudo you are running this script as root, and this message should appear on root desktop. Same result you will get when you will be login as root, and try run this script as normal user.

  • Is there a way that the desktop notification could be shown to the normal user?
    – giantas
    Mar 22 '17 at 7:03
  • message from root? yes, but I'm not sure if it's possisble to shown this message by KDE or other WM.
    – darvark
    Mar 22 '17 at 7:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.