0

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
  • Don't put "Solved" into the question's title. Accept the answer. Then the question will automatically be marked as solved. –  Jan 06 '17 at 15:50

1 Answers1

0

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

Community
  • 1
  • 1