1

Is there a way to close the Gnome Files Window automatically when unplugging a USB-drive?

I am working on an embedded project upploading new software via STLINK. The STLINK has a neat feature of simulating a usb-drive for uploading new firmware. Each time the firmware is uploaded the device disconnects and reconnects, which makes Gnome spawn a new Files Window. I would like to have one window closed and one window started, but as my code is not flawless I end up with hundreds of windows after a while. All that I have to close using one by one using the mouse pointer.

[Edit] It was not exactly solved but good enough by following sudodus recommendation below to prevent opening of new windows. Disable auto-opening nautilus window after auto-mount. This works very well since the USB-icon still shows up in the left side Dock.

cagru
  • 11
  • Which version of Ubuntu are you running? Maybe it would work for you to turn off the opening of a file browser window, when a USB drive is [or seems to be] connected? – sudodus Aug 05 '20 at 09:17
  • 1
    Thank you! I was stuck in my idea of closing the window. But this works just fine and was easy to do and explained in https://askubuntu.com/questions/191527/disable-auto-opening-nautilus-window-after-auto-mount . Especially since the USB-icon still is shows up in the dock. – cagru Aug 12 '20 at 17:18

1 Answers1

0

I may suggest to work on this project on a tty. It is simply a terminal without GNOME DE. Open it through

Ctrl + Alt + F1/F2

A tty can be opened alongside a GNOME desktop just like a "workspace", so you can shift between the GNOME desktop and tty easily. To go back to the GNOME desktop, press

Ctrl + Alt + F7