How to lock desktop icons on XFCE

I'm wondering if is there any way to have a functionality like in KDE: I can set icons to be "locked", so they will not change of location. But in XFCE when I start a game in 800*600 resolution and then return to the desktop it's all messed up. Any solution to this?

Thank's for your time


I found a solution on the Ubuntu forums (it's a link from the link Michael Barlach provided).

  • First run this in a terminal:

    sudo chattr +i ~/.config/xfce4/desktop/icons*
    
  • This will lock your icon placement, so that when the desktop is resized, your icons technically remain in the same place.

  • When your desktop gets resized, press F5 to reload it.
  • Optionally, you can create a launcher on the panel with this command: xfdesktop --reload which will reload the desktop.

If you need to reverse the lock on your icon placement run:

sudo chattr -i ~/.config/xfce4/desktop/icons*

An alternative approach without the need for repeated use of "sudo chattr" is described here: http://odoepner.wordpress.com/2012/03/08/backuprestore-xfce-desktop-icons/


What that says is:

Create a file (e.g. save-xfce-desktop-icons.sh) with this content:

#! /bin/sh
mkdir -p ~/.config/xfce4/desktop.bak
cp -f ~/.config/xfce4/desktop/icons* ~/.config/xfce4/desktop.bak

and another one (e.g. load-xfce-desktop-icons.sh):

#! /bin/sh
cp -f ~/.config/xfce4/desktop.bak/icons* ~/.config/xfce4/desktop

Make the scripts executable and in the XFCE start menu, go to “Settings” – “Keyboard” – “Application Shortcuts” and configure 2 keyboard shortcuts for them.


Here is something that worked for me.

I noticed that the problem appeared when I created a panel along the upper side of the screen. When I changed this panel from 32 pixels to 40 pixels, it solved the issue. I noticed that the icons sometimes got slightly under the panel what gave me the idea of trying to change the size of the panel. Hope this can help others and maybe help identify the origin of the bug.