Shared Folders With Shared Icons in Nemo

MagicMint
  8 years ago
  0

Introduction

Nemo’s custom icons for folders are a nice feature which helps to categorize contents visually, as demonstrated at the bottom of another article here on the site, for instance. However, this feature turns out not to be as useful as it could be: because the file manager possesses only a local view on shared resources like music, picture, etc. collections, icons on such folders won’t be propagated throughout the network, as it has been remarked elsewhere.

Fortunately, Nemo (and Nautilus 3.x for the matter, but that doesn’t profit to Caja, which is based on Nautilus 2.x) has an extensible architecture, so it can be provided with a right-click action to show the same icon for a shared folder independently of the computer — and user — viewing it cool

Step 1: The script

You have to make up the script just once, provided you do it in the right place. In order to illustrate the procedure, I will setup that favorite picture folder of mine as an example. Let’s suppose that you’ve put the stuff to share into your Public folder — where it obviously belongs to wink

Iconshare in Public
 

Thus, copy the iconshare script to download from your Download folder to a folder shared previously which you have a write access to. The script is admittedly lengthy, but the reason for this is that actually there are three of them for the price of one smiley, and the actions are translated into some of the sample languages from another Nemo tutorial already.

Step 2: Server-side installation

If you open a terminal from within a remote folder in Nemo (not necessarily Public in the example above, but in the general case when you access a share from another machine), it may or may not start in the right directory, i.e. the one with a path starting with “/run/user/…”. Hence, there should be a fool-proof way of installing a script like iconshare on every machine accessing it.

The best method is therefore to drag the script from the shared folder — remote or not — to the desktop, to right click (on the desktop)› Open in terminal, and finally, to execute the following command line there (by copy ’n paste):

…$ chmod u+x iconshare && ./iconshare --install

 

By doing this, the script on the desktop will split up itself, and establish for the current user three files in the actions folder of Nemo: iconshare.sh, iconshare.nemo_action, and dirface.nemo_action. This has to be done once for each user account to be allowed to manipulate shared icons on the server itself.

Step 3: An icon to share

Now, as the artistic part of your endeavor, choose or create a dedicated icon for a shared folder based upon its content. In order to be still able to identify a folder as such, you should respect the graphical language of your icon theme. Thus, editing an image for this purpose is most likely the better solution, so for blending cover art with the standard theme of Linux Mint, follow this wonderful tutorial of @chilipadi, but export the final image to the folder to share rather than to the desktop, and don’t assign it as an icon yet.

Although you could do this manually, it’s easier to make use of the actions you’ve installed in the previous step as they give the image a correct name by hiding it — if View› Show Hidden Files isn’t checked in Nemo — at the same time. So, simply right click (onto the image)› Set as Folder Face like in the following picture. And remember, you’ll have to repeat this step for each folder you want to have its own “face”.

The Colosseum in Rome
 

Step 4: Sharing the folder

Nemo comes with the ability to share folders with just a few clicks, and in LM 17.x this should work out of the box. So let’s right click (on that Public folder)› Sharing Options› Share this folder under the name “Europe” with — well cheeky — the greater public, i.e. with everybody without the need for a password:

Sharing Europe
 

Step 5: Client-side installation

At this stage, you can log in from any machine on the network to the share either by simply opening it from the Network in the Places sidebar of Nemo, by entering its location into the location bar directly, or by clicking File› Connect to Server… on its menu. With the view on the share opened, repeat Step 2 from above for each user account on each client machine which you want the shared icons to be used on.

Step 6: The fun cool

Finally, we’ve got to the point where you can simply right click (on a shared folder)› Show Shared Icon on (it) like in the following picture, a step you have to make once for each folder with a shared icon, on a per user basis on each client machine:

Sharing an Icon
 

In order to show the effect of the action above automatically, you should have the utility xdotool already installed on the clients. Otherwise, you’d have to View› Reload the folder’s view, which you could do by pressing either [Ctrl+r] or [F5] too — or even much simpler, by clicking on the corresponding button in Nemo’s toolbar, if only Edit› (File Management) Preferences› Toolbar› Show refresh button were checked wink

Rome Folder Icon
 

Some remarks

  1. If there is no file named “.dirface” in the folder, the action Show Shared Icon on … will reset its icon to your theme’s default — something Nemo cannot do on its own;

  2. The icons of all the objects (whether files or folders) shown by Nemo are stored by their exact path, i.e. shared icons are remembered strictly by login paths only. Therefore, you’ll have to possibly redo Step 5 if you change from one of the methods to open a share in Step 2 to another;

  3. The method presented above will work with local folders as well as with remote ones, whether on a computer or an NAS. That is, any kind of access protocol for a folder will do, be it file: (for the local ones), smb: (as in the example used), nfs: (the UNIX standard), afp: (Apple’s standard), ssh: (which renders in Nemo as sftp:), or others;

  4. Last but not least, the action Show Shared Icon on … can be applied to a bunch of selected folders at onceyes

Icons on Folders

 

Comments
MagicMint 8 years ago

Done. According to wc, it’s 45% shorter now ;-)


MagicMint 8 years ago

@Hammer459: Coming soon…


Hammer459 9 years ago

@MagicMint I was talking about putting the script on github or some such and remove it from the tutorial. This way it is easy to download and it does not take up 1/3 of the tutorial text.


MagicMint 9 years ago

If your server has XFCE running instead of Cinnamon, install the script as in Step 2 above, and then make up a custom action in Thunar with ~/.local/share/nemo/actions/iconshare.sh --face %F as command for image files with pattern *.jpg;*.jpeg;*.jp2;*.png;*.svg. See Edit Action resp. Edit Appearances.


MagicMint 9 years ago

@Hammer459: I know, but not around Christmas… It’s up to Santa to make packages now ;-)

Anyway, GitHub isn’t that good for tutorials, and this site isn’t well suited for long scripts. So I think, it was just for the sake of testing the feasibility, even if the needs the tutorial covers could be marginal…


Hammer459 9 years ago

Nice tutorial, all parts present and well described.
Even better if you had placed the script as a downloadable from github or some such instead of having to cut and paste from this text. Both to make it easier and to make the tutorial text more readable.
I am not sure I'd be bothered myself to implement it though :-)