I want to detect the existence of a (directory on a) USB drive (/media/pi/Music), wait for it to appear, then open it in the GUI. Using xdg-open /media/pi/Music in ~/.config/lxsession/LXDE-pi/autostart (putting in a crude sleep 3 before the command) opens it twice with the error message that it does not exist, but it obviously does. It would also be nice to be able to tell it what size to make the window.


Have some of the answer. findmnt /media/pi/Music returns nothing if not there and a list of info if it is. Can use this to detect the drive. Still have no solution to the xdg-open behaviour or a nice way to size the window.

  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Mar 4 '20 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.