TransWikia.com

Hiding certain mount points from Caja file manager (MATE desktop)

Ask Ubuntu Asked by Wirawan Purwanto on October 3, 2020

I have quite a number of bind-mounted directories on my computer (running Ubuntu 20.04 MATE edition). Unfortunately they all showed up under “Devices” on the left sidebar of Caja file manager. I wonder if these bind-mounted “mount points” can be hidden (or if certain paths can be excluded from the list of devices shown in Caja). They become clutter and I really don’t want them to show up as “devices”. Because they are not.

Wirawan

One Answer

That is a known bug, caused by libmount, and you can read more about it in GNOME Glib issue #1271.

Caja uses GIO which uses libmount directly and has no feature to be able to hide drives / volumes (x-gvfs-hide does not work).

You can patch Caja yourself, but you will have to rebuild the package which is just a matter of something like: saving the below patches as .patch files, apt source caja, apt build-dep caja, go inside the Caja source directory, patch -p1 < PATCHFILE.patch, dpkg-buildpackage -rfakeroot -uc -b, install the new .deb package.

This one will hide volumes not associated with a drive (save this as: hide_no_drive.patch):

diff -Naur a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
--- a/src/caja-places-sidebar.c 2020-02-10 11:52:32.000000000 +0100
+++ b/src/caja-places-sidebar.c 2020-06-12 15:30:50.979210881 +0200
@@ -715,6 +715,7 @@
     g_list_free (drives);
 
     /* add all volumes that is not associated with a drive */
+    /*
     volumes = g_volume_monitor_get_volumes (volume_monitor);
     for (l = volumes; l != NULL; l = l->next)
     {
@@ -750,7 +751,7 @@
         }
         else
         {
-            /* see comment above in why we add an icon for an unmounted mountable volume */
+            // see comment above in why we add an icon for an unmounted mountable volume
             icon = g_volume_get_icon (volume);
             name = g_volume_get_name (volume);
             last_iter = add_place (sidebar, PLACES_MOUNTED_VOLUME,
@@ -763,6 +764,7 @@
         g_object_unref (volume);
     }
     g_list_free (volumes);
+    */
 
     /* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
     network_mounts = NULL;

This one will hide mounts that have no volume (save this as: hide_no_volume.patch):

diff -Naur a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
--- a/src/caja-places-sidebar.c 2020-02-10 11:52:32.000000000 +0100
+++ b/src/caja-places-sidebar.c 2020-06-12 15:38:56.846812120 +0200
@@ -766,6 +766,7 @@
 
     /* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
     network_mounts = NULL;
+    /*
     mounts = g_volume_monitor_get_mounts (volume_monitor);
 
     for (l = mounts; l != NULL; l = l->next)
@@ -809,7 +810,7 @@
         g_free (tooltip);
     }
     g_list_free (mounts);
-
+    */
 
     /* add bookmarks */
     bookmark_count = caja_bookmark_list_length (sidebar->bookmarks);

Another thing you can try is rebuilding glib (which contains GIO) and modify the Meson build to use -Dlibmount=false or -Dlibmount=disabled. This will disable the use of libmount system-wide for everything that uses GIO also inside GTK file dialogs.

Answered by Deorder on October 3, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP