Converting from nautilus to caja desktop icons

I recently upgraded from Gnome2 to… mate. Let’s not get into the reasons, since this is just about solving the desktop icons.

So getting straight to it: in nautilus, all the metadata about files as they appear in the GUI (so: icon position, size, emblems, etc) exist in a series of files in $HOME/.local/share/gvfs-metadata
(each file in there related to a filesystem)

caja, on the other hand, uses the SAME FILES – but sometimes different metadata.

So, when I moved from gnome2/nautilus to mate/caja, I found that my desktop icons retained their same sizes, emblems… but not location.

Why is this so?

So if you try running this:

bounty:~ $ gvfs-info -a "metadata::*" ~Desktop

You should get a bunch of output, something like:

attributes:
metadata::annotation:
metadata::emblems: [certified, desktop, system]
metadata::icon-scale: 1
metadata::nautilus-default-view: OAFIID:Nautilus_File_Manager_List_View
metadata::nautilus-icon-position: 1432,-3
metadata::nautilus-icon-position-timestamp: 1226057199
metadata::nautilus-icon-view-auto-layout: true
metadata::nautilus-icon-view-sort-by: name
metadata::nautilus-icon-view-tighter-layout: false
metadata::nautilus-icon-view-zoom-level: 1
metadata::nautilus-list-view-sort-column: date_modified
metadata::nautilus-list-view-sort-reversed: true
metadata::nautilus-list-view-zoom-level: 1
metadata::nautilus-window-geometry: 857x761+2017+96
metadata::nautilus-window-scroll-position: file:///home/nemo/Desktop/sunpath

If you’ve been playing with caja already, you’ll have some “metadata::caja-*” attributes too.

So in a nutshell, metadata::emblems and metadata::icon-scale naturally enough are seen by caja as easily as nautilus, but metadata::nautilus-icon-position is invisible to caja, which expects to see metadata::caja-icon-position.

Converting from one to the other is almost trivial. Lookup the value with gvfs-info, then set the value with gvfs-set-attribute.

Right?

Not quite.

I did that, and while the relative positions of my desktop icons were correct, they were too far apart (and so: some were off the screen)

For reasons I do not know (and for all I know, are specific to some quirk in my personal setup), I had to scale all the geometry values down by approx a third. (for the record, that means my caja-icon-position seems to be based off my screen resolution, whilst nautilus’ were not?

Anyway, my final solution was this short script (I named it gvfs2matevfs)

#!/bin/bash

iconpos=$(gvfs-info -a "metadata::nautilus-icon-position" "$@" | grep nautilus-icon-position | awk -F: '{print $4}')

# so by my estimate, caja-icon-position is about 2/3 the value of nautilus-icon-position
if [ -n "$iconpos" ] ; then
  ex=$(( ${iconpos%,*} * 67/100))
  wy=$(( ${iconpos#*,} * 67/100))
  gvfs-set-attribute -t string "$@" "metadata::caja-icon-position" $ex,$wy
  echo "$* $iconpos : $ex,$wy"
fi

I then ran this this thusly (note: from the Desktop)

bounty:~/Desktop $ find . -maxdepth 1 -print0 | xargs -0 -n 1 ~/bin/gvfs2matevfs

And (after refreshing the desktop icons by moving to an empty workspace and hitting F5) viola, there they are, where I want them! :)

(oh, and you’ll have to run all the above from within a running mate/caja environment, otherwise gvfs isn’t visible)

2 thoughts on “Converting from nautilus to caja desktop icons

  1. Brian

    Dear Sir, this is exactly what I want for so long!! I an still using Fedora 14 because I do not want to lose the classical working environment, and I definitely want to keep the icon position information for my files/folders. Now with your post, I see a hope to move on to the newest Fedora with Mate desktop, where caja is the file manager. Could I know how I can apply your methods for all the folders/files under my home directory? Is there any update/tool on this issue (i.e., moving the Natilus’s gvfs-metadata to Caja and keep all the information including the icon positions)? Thank you so much!

    Reply
    1. nemo Post author

      This was a long time ago for me, can’t really provide any further information than what I wrote in 2012. I only saw issues with my desktop icons which was resolved with the script I quoted above. I don’t recall seeing any issues with folder settings inside nautilus (or if I did, I didn’t care).

      (only other thing I’d note is that I think I was moving from Ubuntu to Mint at the time I changed from Gnome2 to MATE, and that may have contributed to the effect. It may not affect you with remaining on Fedora – or it may affect you worse with a larger version gap to jump. I’ve since moved back to Ubuntu MATE, and had no issues with that transition).

      Good luck!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>