Udev Rule not launching Zenity or Yad (Ubuntu 16)

236 views Asked by At

I've been trying this for a few days and had no success. I want to launch a script file that uses Zenity (or Yad) on disc detection.

I'm using logging to test and the udev rule works and executes the script but fails to launch Zenity.

I'm trying to execute as su based on research of other stackoverflow questions but still I have no success.

Udev Rule

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-ata-5", ACTION=="change", RUN+="/var/lib/plexmediaserver/change.sh"

change.sh

#!/bin/bash 

echo "Ran UDEV RULE from CHANGE.sh at"$(date)>> /var/lib/plexmediaserver/changelog

su USER -c export DISPLAY=:0; /var/lib/plexmediaserver/zenity_movie_rip.sh 

& exit

zenity_movie_rip.sh

su USER -c export DISPLAY=:0; zenity --question
1

There are 1 answers

0
Sudomasochist On

Ok I found a workaround by not using udev rules. I added the script as an application and set the removable media to use that new application

https://unix.stackexchange.com/questions/80822/ubuntu-unity-attach-script-to-launcher