You are not logged in.

#1 2021-07-04 12:05:33

thomasbb
Member
Registered: 2020-05-22
Posts: 52

[SOLVED] How to open a file browser when plugging in a usbstick?

Tried the rule:

SUBSYSTEM=="usb", ATTR{serial}=="serialnumber", SYMLINK+="myusb", RUN+="/home/user/bin/usb-on.sh", ACTION=="add"

with the script usb-on.sh

#!/bin/bash
echo "usb is online " >> /tmp/usb.out
/bin/date >> /tmp/usb.out
xdg-open /tmp/usb.out # no effect
/usr/bin/nautilus # no effect

but despite the fact the tmp file appears as expected, the xdg and nautilus calls have no effects. Did I miss something?

Last edited by thomasbb (2021-07-04 13:07:23)

Offline

#2 2021-07-04 12:32:59

lmn
Member
Registered: 2021-05-09
Posts: 93
Website

Re: [SOLVED] How to open a file browser when plugging in a usbstick?

udev rules are not being run as your user, and especially do not know about your graphical setup.

You should probably be using systemd, see this thread for more.

Offline

#3 2021-07-04 13:07:03

thomasbb
Member
Registered: 2020-05-22
Posts: 52

Re: [SOLVED] How to open a file browser when plugging in a usbstick?

Thanks for the link

Offline

#4 2021-07-04 14:54:57

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,467

Re: [SOLVED] How to open a file browser when plugging in a usbstick?

i still go the hacky way since years;
worked for cron, it would work from udev too:
https://bbs.archlinux.org/viewtopic.php … 0#p1709570


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2021-07-08 20:35:52

thomasbb
Member
Registered: 2020-05-22
Posts: 52

Re: [SOLVED] How to open a file browser when plugging in a usbstick?

This week end I give it a try
@kokoko3k Perfect, thank you very much

Last edited by thomasbb (2021-07-14 09:50:11)

Offline

Board footer

Powered by FluxBB