From 0662f7b37464ed7da428762d62cb9ce01e583406 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Thu, 26 Sep 2024 19:28:07 +0200 Subject: content: Add post: "Pretty names for mount points in /etc/fstab" --- content/21/index.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 content/21/index.md (limited to 'content/21/index.md') diff --git a/content/21/index.md b/content/21/index.md new file mode 100644 index 0000000..384509f --- /dev/null +++ b/content/21/index.md @@ -0,0 +1,57 @@ ++++ +date = 2024-09-26T19:27:54+02:00 +title = "Pretty names for mount points in /etc/fstab" + +[taxonomies] +tags = ["TIL"] + +[extra] +related = [] ++++ + +The file manager I'm using on my Plasma 6 system, +[Dolphin](https://invent.kde.org/system/dolphin), has built-in support for +remote folders via the [KIO](https://invent.kde.org/frameworks/kio) framework. +Where before I was relying on [sshfs](https://github.com/libfuse/sshfs) mount +points in `/etc/fstab`, I decided to try out the Dolphin way and set up my +remote devices using its `sftp` backend. + +After a couple of days now I can say that this works beautifully... until you +want to access the remote device on something that does not interface with KIO. +This is especially important for me (and +[others](https://invent.kde.org/plasma/plasma-desktop/-/issues/71#note_640907)) +since I want to be able to browse networked filesystems via my terminal and have +the ability to directly open a terminal in that location through Dolphin, +something which is not possible with the KIO backend. + +So in the end I went back to mount points in `/etc/fstab`. One small problem +remained, however, and that was the way those mount points were displayed +within Dolphin. There seemed to be no way to customize a mount point's name or +icon, leading to an annoyingly long `/home/wolf/net/hosts/coleridge` entry in +the *Devices* section of Dolphin's places panel. + +I couldn't find any help in `fstab(5)`, and indeed I had never heard of a way +to give a mount point a "pretty name". However, after a bit of searching, I +found people offhandedly mentioning the `x-gvfs-name` option. Some more +searching revealed that nobody seems to care about documenting these features, +but I was finally able to find an authoritative source within [gvfs +itself](https://github.com/GNOME/gvfs/blob/989d746ed771fc5e5bf134677cf8d571170b262e/monitor/udisks2/what-is-shown.txt#L29-L35). + +Happily there's not only `x-gvfs-name` but also support for custom icons +through `x-gvfs-icon`. So, if you want your file manager to display a pretty +name and icon for one of your mount points, simply add the following to the +relevant entry in `/etc/fstab`: + +``` +x-gvfs-name=My%20Device,x-gvfs-icon=network-server +``` + +This should be possible at least on GNOME and KDE desktops. I imagine a bunch +of other environments and programs silently support this behaviour as well. + +{{ img(path="places.png", format="png", alt="A screenshot of Dolphin, KDE's +file manager, showing the user's home directory with the places panel on the +left side containing various categorized entries. The entries below the Devices +category read flood, demeter, coleridge, and OnePlus 12, each with its own +pretty name and relevant icon.", caption="Dolphin displaying pretty names and +icons in the *Devices* category") }} -- cgit v1.2.3-2-gb3c3