This question already has an answer here:
- Call notify-send from an udev rule 2 answers
I have been trying to make a
udev rule for a while, but without succes. For testing purposes, I have a file
/etc/udev/rules.d/80-power.rules which contains
Supposedly, this should run the specified script whenever a device like a USB stick is added (I monitored
udevadm and the action indeed is
add when plugging in a USB stick). This is not actually what I want to achieve in the end, but it seemed like the easiest way to at least get some kind of
udev rule working. If you think the problem lies here, feel free to suggest an even simpler rule, I'd be glad to get any rule at all working.
The script in
notify-send -i face-worried "Geen stroom!" "Sluit de adapter aan of de computer valt misschien uit."
and should send a notification.
Both files mentioned can be read and executed by root and all users. Using bash I have manually run the script in the second file (both as root and as normal user) and it works just fine. I have rebooted the system several times. I don't know what to try anymore. Thank you for your help.
I am working on a laptop with Ubuntu 16.04 installed.
Update: I have been looking at the duplicate question and the links in the comments, but haven't gotten much wiser. Updating my script to the script
#!/bin/bash export DISPLAY=":0" notify-send "device plugged"
and rebooting did not solve anything, while it did at least partially work for the dupplicate questions's OP. I tried to follow the steps in the first two answers of this question but without effect. And I do not understand what this question is even about.