1

I have found gvfs-info to display the data, including position, of a desktop icon, and I can set the position info of item xyz.png on the desktop by doing:

gvfs-set-attribute ~/Desktop/xyz.png 'metadata::nemo-icon-position' 142,972

This results in output of further gvfs-info calls that is the same as if you dragged the icon to that position and called gvfs-info). Unfortunately Cinnamon doesn't get notified of this change and continues to display the icon at the old position. If you restart mdm the icon will be in the new position, but this is a bit to drastic a measure to get my icons aligned. cinnamon --replace, doesn't reload the positions (but a restart of mdm after that does).

Is there a command line way to notify Cinnamon to reread this info and update the desktop icon position? Or is there some other commandline utility that allows me to set the x,y position of a desktop item for Cinnamon?

Background:

Since I swapped my broken graphics card that supported only 2 monitors for a new one, I have all 3 monitors as one desktop: 2 landscape oriented and one portrait oriented. The whole setup looks like my gravatar. I used to have the third (landscape) monitor on a different system driven via x2vnc so I could share the keyboard and mouse, in that situation I never had the following problem.

Since swapping the problem is that when I have items on my desktop and I right-click the desktop and select "Sort Desktop items by Name" that the icons disappear (Linux Mint 17.1 Cinnamon, same problem occurred on Ubuntu 12.04 Classic Gnome). They items/icons are actually in the upper left corner above the left monitor. If there are enough icons on the desktop some will show up at the left border. I can select all icons and drag them to the right monitor to see them (it is "high" enough), and I can also open nemo to ~/Desktop and drag the icons from there to the visible area of the monitors.

What I would like to do is write a script that queries the current position of the desktop icons and move them somewhere else where they are visible.

1

After playing with killing the various cinnamon- processes and their children, you find that killing nemo -n and restarting it will do the trick of positioning the file after a gvfs-set-attribute. Killing nemo -n restarts all of it subprocesses as well, which is not so nice.

It suffice however to temporarily move the file from the Desktop to a temp directory and then back to have it reappear in the position specified:

$ touch Desktop/abc.txt

Right-click desktop and select "Sort Desktop icons by Name" if abc.txt happens to be shown.

$ gvfs-info ~/Desktop/abc.txt | grep position:
  metadata::nemo-icon-position: 64,322
$ gvfs-set-attribute ~/Desktop/abc.txt metadata::nemo-icon-position 64,722
$ mv abc.txt /var/tmp/; mv /var/tmp/abc.txt ~/Desktop/

And the icon for abc.txt is visible.

1

I'm using Ubuntu 14.04 and am not too familiar with Cinnamon. But Ubuntu Nautilus also uses "gvfs-set-attribute" to set icons.

In Ubuntu, you need to refresh the desktop after sending a "gvfs-set-attribute" command in order to update the desktop icon layout. You do that by depressing F5. The F5 command also works in Cinnamon. If you want to do this within bash, you can do it using the small utility xdotool with this command:

xdotool key F5

There is a bash script call "Happy Desktop" that can save and restore your icon positions for you as well as organize them to a grid. Just google it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.