5 years ago
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
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
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 , and the actions are translated into some of the sample languages from another Nemo tutorial already.
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.
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”.
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 — the greater public, i.e. with everybody without the need for a password:
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.
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:
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
Done. According to wc, it’s 45% shorter now ;-)
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.
@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…
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 :-)