Xfce Devices display in Thunar

Hi,
I'm new here and also new to FreeBSD 10.2. I've been getting to know FreeBSD in a VirtualBox VM for some time now and it's been a nice experience. I've installed Xfce 4.12 and it's working fine.

There is something very intriguing that I've been trying to figure out with no luck: When I mount a filesystem in /media, it automatically shows up in Thunar's devices (on the left panel). How does Thunar know that?

The reason I ask is because I would like to try to extend this to the desktop itself. The show removable devices option does not work under FreeBSD, and as far as I know now it has something to do with udev which is Linux only? Then again, Thunar has some magic that makes it work.

Another question is how is Thunar able to umount the filesystem, it not being root? There's even a nice notification popup. How is this synchronized?. I've ran out of google keywords and grep words. Any pointers are appreciated, I'd really like to understand this.

Thanks,
Sjef.
 
There is something very intriguing that I've been trying to figure out with no luck: When I mount a filesystem in /media, it automatically shows up in Thunar's devices (on the left panel). How does Thunar know that?

Under Xfce session, Thunar is launched like daemon (also gvfs for trash support), so if something is mounted it knows it (through the GIO API). It contains also kqueue/kevent backend (to monitor kernel events) used in BSD world.

GIO is an abstract model for file system (information about file system, mount volume, etc.). It supports by default some known mount points specially /media.

The reason I ask is because I would like to try to extend this to the desktop itself. The show removable devices option does not work under FreeBSD, and as far as I know now it has something to do with udev which is Linux only? Then again, Thunar has some magic that makes it work.

Xfdesktop knows if volume is mounted or not, internal it "watches" events coming from Thunar. It's on my TODO list to write udev-like for Xfce, because I need this library for others projects (like LxQt, Pantheon, Vera). In base system we have everything, to know what kind of file system is when we use removable media.

Another question is how is Thunar able to umount the filesystem, it not being root? There's even a nice notification popup. How is this synchronized?. I've ran out of google keywords and grep words. Any pointers are appreciated, I'd really like to understand this.

Currently Thunar/Xfdesktop can't mount (or unmount) device automatically, but in future perhaps :)
 
Thanks olivierd. Your answer confirms what I've learned between posting this question and now, by going through the Xfce source. My system was first configured without HAL, only D-Bus. In that situation, Thunar will automatically update its side panel with the device (e.g. da0p1). But the desktop will not update anything as it only listens for volumes, not devices. So after adding hald_enable='YES' to /etc/rc.conf things worked as expected.

I haven't had much time to further study how the Xfce desktop is 'wired' into the system, but it seems like this could be made much more elegant, at least under FreeBSD. I've dealt with PolicyKit, ConsoleKit, D-Bus and HAL, just to see icons of volumes on my desktop and to be able to shutdown/restart.
 
Back
Top