I want a notification in desktop that a particular USB device is inserted.Hence the following is the udev rule.
KERNEL=="sd*",SUBSYSTEMS=="usb",ACTION=="add",RUN+="/home/username/Desktop/notify_script"
notify_script is as follows
#!/bin/sh
su username -c 'notify-send "USB Inserted"'
echo USB_inserted >> /home/username/Desktop/test_file
Problem :
The above script works perfectly if it is executed as root from command line but, notify-send in script is not working if executed from udev.
Question:
How to make notify-send work from udev? or
Is there any other way by which I can achieve notification ?
Is it possible to invoke any GUI from udev?
Thank you.