Skip to main content
added 100 characters in body
Source Link

I am trying to launch a GUI app upon plugging in a certain USB device. The udev rule gets triggered, but the app does appear on my screen. Running the script from another TTY makes the app open in my graphical environment. I can also confirm that the rule is getting triggered by appending a date to a file from the rule.

/etc/udev/rules.d/99-betaflight.rules:

SUBSYSTEMS=="usb", ATTR{serial}=="314839673237", RUN+="/usr/bin/su daniel -c '/home/daniel/bin/betaflight-configurator'" 

/home/daniel/bin/betaflight-configurator:

#!/bin/bash export DISPLAY=:1 /opt/betaflight/betaflight-configurator/betaflight-configurator 

The way I understand it is that the GUI app has difficulties starting, since it's not starting in the context of the X server. Still, running the code from another tty opens the app perfectly fine.

What can I improve to make the app run upon plugging in my USB device?

I am trying to launch a GUI app upon plugging in a certain USB device. The udev rule gets triggered, but the app does appear on my screen. Running the script from another TTY makes the app open in my graphical environment.

/etc/udev/rules.d/99-betaflight.rules:

SUBSYSTEMS=="usb", ATTR{serial}=="314839673237", RUN+="/usr/bin/su daniel -c '/home/daniel/bin/betaflight-configurator'" 

/home/daniel/bin/betaflight-configurator:

#!/bin/bash export DISPLAY=:1 /opt/betaflight/betaflight-configurator/betaflight-configurator 

The way I understand it is that the GUI app has difficulties starting, since it's not starting in the context of the X server. Still, running the code from another tty opens the app perfectly fine.

What can I improve to make the app run upon plugging in my USB device?

I am trying to launch a GUI app upon plugging in a certain USB device. The udev rule gets triggered, but the app does appear on my screen. Running the script from another TTY makes the app open in my graphical environment. I can also confirm that the rule is getting triggered by appending a date to a file from the rule.

/etc/udev/rules.d/99-betaflight.rules:

SUBSYSTEMS=="usb", ATTR{serial}=="314839673237", RUN+="/usr/bin/su daniel -c '/home/daniel/bin/betaflight-configurator'" 

/home/daniel/bin/betaflight-configurator:

#!/bin/bash export DISPLAY=:1 /opt/betaflight/betaflight-configurator/betaflight-configurator 

The way I understand it is that the GUI app has difficulties starting, since it's not starting in the context of the X server. Still, running the code from another tty opens the app perfectly fine.

What can I improve to make the app run upon plugging in my USB device?

Source Link

Launch GUI app from udev rule

I am trying to launch a GUI app upon plugging in a certain USB device. The udev rule gets triggered, but the app does appear on my screen. Running the script from another TTY makes the app open in my graphical environment.

/etc/udev/rules.d/99-betaflight.rules:

SUBSYSTEMS=="usb", ATTR{serial}=="314839673237", RUN+="/usr/bin/su daniel -c '/home/daniel/bin/betaflight-configurator'" 

/home/daniel/bin/betaflight-configurator:

#!/bin/bash export DISPLAY=:1 /opt/betaflight/betaflight-configurator/betaflight-configurator 

The way I understand it is that the GUI app has difficulties starting, since it's not starting in the context of the X server. Still, running the code from another tty opens the app perfectly fine.

What can I improve to make the app run upon plugging in my USB device?