About me

Music producer, (ex-)DJ, electronics tinkerer, Linux enthusiast and coder.

Indicator menu for recent network folders


The Gnote indicator I recently built turned out to be useful for many, so I polished another indicator app for sharing. Whether you simply browse a home NAS, share business files on a Samba/Windows server, or edit code on development servers through SSH or FTP, you may find this tool useful.

I often work on files on servers near and far, and while one can bookmark any remote folder for quick access, managing dozens of temporary bookmarks is laborious, so I developed an indicator menu to provide shortcuts to recently accessed remote folders. It was quite easy, as the OS (pretty much any GTK-based Linux desktop) provides a list of recently accessed files, including remote ones, in a simple XML format: ~/.local/share/recently-used.xbel

My Python script monitors changes in the XML file and reads all remote entries, stripping file names to provide the indicator menu listing the most recent directories, so you can return to work on any of them with just two clicks. Currently supported schemes are AFP, FTP(S), SMB, SSH (SFTP) and WebDAV.

Installing

Use these commands to install (and upgrade, if I decide to improve this later on):

wget https://github.com/Martinique/indicator-rnf/raw/master/indicator-recent-network-folders
chmod +x indicator-recent-network-folders
sudo mv -f indicator-recent-network-folders /usr/local/bin


You can uninstall with sudo rm /usr/local/bin/indicator-recent-network-folders

Usage

You can start the indicator from a terminal or Alt+F2 by entering indicator-recent-network-folders. Add it to your Startup Applications to have it start automatically.

The app will use your default file manager to open the folders, but if you have multiple managers installed, you can run it with an option specifying which one to use. Example:

indicator-recent-network-folders --browser nautilus

By default, no more than 20 folders will be listed. If you need to see more, use the -c option:

indicator-recent-network-folders -c 40

Troubleshooting

If the indicator fails to start, complaining that "Namespace AppIndicator3 is not available", you'll need an additional package:

sudo apt install gir1.2-appindicator3-0.1

If you haven't accessed any network servers recently, the indicator menu will display "No data available". Simply open a file on any network share, and the folder should appear on the list.

If you still don't see any entries appearing, open your File History settings (assuming GNOME desktop) and make sure it's enabled. I'm not sure if that switch is accessible in all desktop environments, but you can also set it using Dconf Editor by browsing to org/gnome/desktop/privacy/remember-recent-files.

I've seen many forum posts describing ways to make recently-used.xbel unwritable for various reasons, so check that you haven't done something like that. Deleting the file might be the easiest way to make it work.

While the underlying GVfs system supports native Google Drive access, unfortunately Drive's file URLs use a completely different https scheme instead of google-drive, so there doesn't seem to be a way to connect those.

Once again, suggestions for improvement are welcome.

0 comments:

Post a Comment