Xfce Forum

Sub domains
 

You are not logged in.

#1 2012-11-13 12:50:21

lazork
Member
Registered: 2012-11-13
Posts: 5

Desktop icons rearrange on reboot

I've already looked a round on this forum for a solution, but the only thread I found doesn't have one.
Basically my desktop icons rearrange themeselves every time I login.
I've already tried to backup the icons on shutdown/logout by replacing the launcher on the panel with the script:

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

and this is working, but I haven't managed to automatically restore them when the session starts.
I tried adding this script to the list of programs executed on login:

#!/bin/sh
sleep 20
cp - f ~/.config/xfce4/desktop.bak/* ~/.config/xfce4/desktop
xfdesktop --reload

I know the script is being executed because I can see the desktop reloading after 20 seconds, and I know that if I launch the script manually it does its job.
Still, it doen't properly restore the icons positions if it's automatically executed (I really can't understand why!).

Am I the only one whose icons keep moving?
Is there a way to fix this issue (either by preventing them to move, by fixing my scripts or by some other means)?
Thanks in advance to anyone who can share some ideas

Offline

#2 2012-11-13 14:13:13

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: Desktop icons rearrange on reboot

Here is another suggestion. Once you have the icons in the location that you want, execute the following command to make the icon config file read-only:

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

This way, none of the changes will be saved/reverted and on every login, the icons should revert to their saved locations. If they are shuffled during operations, a simple "xfdesktop --reload" should reset them.

Note that if you want to permanently move icon locations, you will have to run:

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

...to make the files writeable again.

Last edited by ToZ (2012-11-13 14:13:47)


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2012-11-13 14:42:46

lazork
Member
Registered: 2012-11-13
Posts: 5

Re: Desktop icons rearrange on reboot

The problem is that making the files immutable won't allow me to add or move files on the desktop in the future.
Since I'm not the one who will be using this computer, I need it to behave properly without needing the user to take any particular action.

Offline

#4 2012-11-13 16:40:31

golinux
Member
Registered: 2011-11-19
Posts: 127

Re: Desktop icons rearrange on reboot

Because of xfce's inability to allow for custom arrangement of 'permanent' desktop icons, I have removed all of them to a hidden panel with custom launchers.  Now I only use my desktop as a transitional area for downloads and currently working files that will eventually be shuttled off elsewhere.   I'm really liking a pristine desktop uncluttered with icons (most of the time).  smile

Offline

#5 2012-11-13 19:28:09

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: Desktop icons rearrange on reboot

lazork wrote:

The problem is that making the files immutable won't allow me to add or move files on the desktop in the future.
Since I'm not the one who will be using this computer, I need it to behave properly without needing the user to take any particular action.

Ahhhh, I see. I just tried out your scripts in a 4.10 VM and they worked fine - in that the icon locations restored after the 20 second delay. I did notice an error in your script (space between "-" and "f" in the copy command), but it still worked regardless.

What version of Xfce are you using?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#6 2012-11-14 12:09:04

lazork
Member
Registered: 2012-11-13
Posts: 5

Re: Desktop icons rearrange on reboot

ToZ wrote:

Ahhhh, I see. I just tried out your scripts in a 4.10 VM and they worked fine - in that the icon locations restored after the 20 second delay. I did notice an error in your script (space between "-" and "f" in the copy command), but it still worked regardless.

What version of Xfce are you using?

I'm using 4.10 from the archlinux repo.

The space between "-" and "f" is just a typo I made while rewriting the script in my first post, it's not there in the real script.
It kind of works for me too, but it only restores about 80% of the icons (lots of icons on the desktop).
I'll try to further increase the delay to something like 30 seconds (it's an old laptop, it takes it a lot of time to draw all the icons on the desktop, maybe after 20 seconds it's not really finished yet)
Btw, is the desktop drawing speed (or slowness) an issue for anybody else? Not only does it take a lot of time to load the icons in the first place, but the re-drawing, when moving windows over it, it's slow as well...

Offline

#7 2012-11-14 16:11:27

golinux
Member
Registered: 2011-11-19
Posts: 127

Re: Desktop icons rearrange on reboot

lazork wrote:

Btw, is the desktop drawing speed (or slowness) an issue for anybody else?

Yes.  But since I no longer have many desktop icons, it's not much of a problem.

Offline

#8 2012-12-29 09:01:15

Geoffrey
Member
Registered: 2012-12-29
Posts: 1

Re: Desktop icons rearrange on reboot

lazork wrote:

I've already looked a round on this forum for a solution, but the only thread I found doesn't have one.
Basically my desktop icons rearrange themeselves every time I login.
I've already tried to backup the icons on shutdown/logout by replacing the launcher on the panel with the script:

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

and this is working, but I haven't managed to automatically restore them when the session starts.
I tried adding this script to the list of programs executed on login:

#!/bin/sh
sleep 20
cp - f ~/.config/xfce4/desktop.bak/* ~/.config/xfce4/desktop
xfdesktop --reload

I know the script is being executed because I can see the desktop reloading after 20 seconds, and I know that if I launch the script manually it does its job.
Still, it doen't properly restore the icons positions if it's automatically executed (I really can't understand why!).

Am I the only one whose icons keep moving?
Is there a way to fix this issue (either by preventing them to move, by fixing my scripts or by some other means)?
Thanks in advance to anyone who can share some ideas

I had the same problem, I found this works for me, a slight change to your script.

I added this to my logout/shutdown script

mkdir -p ~/.config/xfce4/desktop.bak
xfdesktop --reload; sleep .5; cp -f ~/.config/xfce4/desktop/* ~/.config/xfce4/desktop.bak/

This script to my Startup directory, I know it looks weird, but if I don't call on xfdesktop --reload to begin with, I need to run the script twice to refresh the desktop
and the sleep statements are needed also for it to function correctly.

#!/bin/sh
xfdesktop --reload; sleep .5; cp -f ~/.config/xfce4/desktop.bak/* ~/.config/xfce4/desktop/; sleep .5; xfdesktop --reload

Hope it's of some help.

Offline

#9 2013-01-01 01:43:40

Sideburns
Member
From: Trinidad, CO
Registered: 2011-03-30
Posts: 467
Website

Re: Desktop icons rearrange on reboot

Try this: set up your desktop exactly the way you want to see it when you boot.  (Remember, though, that all programs will open on your first workspace, not the one they were on before.)  Log out, making sure that Save Session for future logins is checked, then log back in.  Unless there's something messing with your settings, this should do it.


Registered Linux user #470359
Permanently recovered BOFH
Any advice in this post is worth exactly what you paid for it.

Offline

#10 2013-06-14 12:54:43

Jussl
Member
Registered: 2013-06-14
Posts: 2

Re: Desktop icons rearrange on reboot

Everyone who are bothered by this issue, please go and mark yourself affected by this bug. Then maybe someone will really fixed it.
https://bugs.launchpad.net/ubuntu/+sour … ug/1190990

Offline

#11 2013-06-14 13:49:19

lazork
Member
Registered: 2012-11-13
Posts: 5

Re: Desktop icons rearrange on reboot

I don't think the ubuntu bug-tracker is the right place to report this and get it fixed.
This seems like a more appropriate bug report:
https://bugzilla.xfce.org/show_bug.cgi?id=9192

Offline

#12 2013-06-14 15:03:53

Jussl
Member
Registered: 2013-06-14
Posts: 2

Re: Desktop icons rearrange on reboot

lazork wrote:

I don't think the ubuntu bug-tracker is the right place to report this and get it fixed.
This seems like a more appropriate bug report:
https://bugzilla.xfce.org/show_bug.cgi?id=9192

Xubuntu is official derivation from Ubuntu, and Xubuntu bugs are also tracked in Launchpad.
So, it surely is right place to report Xubuntu bugs.

But do it get fixed... I assume developers will get the report as well from launchpad (why not?).
But who has time and will to really fix it, I don't know.

Offline

#13 2013-06-14 18:08:28

lazork
Member
Registered: 2012-11-13
Posts: 5

Re: Desktop icons rearrange on reboot

Jussl wrote:

Xubuntu is official derivation from Ubuntu, and Xubuntu bugs are also tracked in Launchpad.
So, it surely is right place to report Xubuntu bugs.

I know, but what I meant to say was that, since this isn't a distribution specific bug, it's better to report it on the xfce bug-tracker rather than on the ubuntu/Xubuntu one.
I don't think the xfce developers are affiliated with Xubuntu (though I might be wrong), and even if the bug got fixed in Xubuntu, it wouldn't necessarily get fixed upstream in xfce.
I, for one, am not using xubuntu; I'm running xfce in archlinux, so a fix in Xubuntu wouldn't fix my problem.

Anyway, there's no arm in reporting it in launchpad as well, so I've subscribed that one too.

Offline

#14 2013-09-14 12:16:57

ts14ic
Member
Registered: 2013-09-14
Posts: 2

Re: Desktop icons rearrange on reboot

Not sure, if it's the same issue here, but my icons were messed around as well, and I have found a fix. (maybe it's better to say "workaround").
In short:
Just don't let your desktop contain icons with the same names.
The rc file containing the icons coords has icon names as entry names. It means, it can't handle multiple files with the same name (not filename).

e.g.
I had a SCP.desktop file with Name=SCP, and a symlink, which also had SCP as it's name.
So whenever the xfdesktop was launched or reloaded, it messed the icons.
Just to check this one, when I was writing this message, I renamed the desktop file to scp-game.desktop, and it hadn't helped either.
So... Just don't let your desktop contain icons with the same names.

p.s.
The rc format is
[icon_name]
row=x
column=y

I wonder, if that could somehow use [file_name] instead of [icon_name].

Last edited by ts14ic (2013-09-15 12:53:16)

Offline

#15 2013-09-30 03:55:47

rjdohnert
Member
From: Raleigh NC
Registered: 2013-09-30
Posts: 17
Website

Re: Desktop icons rearrange on reboot

This is from PC/OS Enterprise Linux 4.1.6 which is an offshoot of OS/4 OpenLinux from the OS/4 OpeenLinux Project http://wwww.os4online.com

2013screen.png


Visit the OS/4 OpenLinux Project
http://www.os4online.com

Offline

#16 2013-10-02 13:43:03

shakebake
Member
Registered: 2012-05-14
Posts: 51

Re: Desktop icons rearrange on reboot

Here is a kludge that I did. You are welcome to it if you want:
I put a desktop icon on my desktop that has a script that will lock/unlock my icons when I
get them where I want. Unlock, then open up all your devices you have, set the icons where you
want, then lock them down. If you want to re-arrange ... unlock them, re-arrange, then lock
them down again. Also, after you set your icons where you want, it is a good idea to make a
back-up of your settings, per whatever
screen resolution you use, in ~/.config/xfce4/desktop/backup
I use icons.screen0-1280x720.rc, therefore I have it backed up in folder
"backup" under ~/.config/desktop

Put this in your Desktop folder:

[Desktop Entry]
Version=1.0
Type=Application
Name=IconLockSet
Comment=
Exec=/home/xxx/scripts/iconlockset.sh
Icon=/home/xxx/Linux_stuff/Icons/icon-lock.png
Path=/home/xxx/Desktop
Terminal=true
StartupNotify=false
LockStatus=Locked
GenericName= 

In the properties:
It should be named "IconLockSet"  ( no quotes )
command should be: "/home/xxx/scripts/iconlockset.sh"  ( no quotes & your home folder instead of xxx )
check "run in terminal"




Put this script in your scripts folder:
It should be named "IconLockSet.sh"


#!/bin/bash

if grep -q "LockStatus=Locked" "/home/xxx/Desktop/IconLockSet.desktop"; then
   echo "It is Locked...we will Unlock it"
   sudo chattr -i ~/.config/xfce4/desktop/icons*
   sed '/Icon=/ c\Icon=\/home\/xxx\/Linux_stuff\/Icons\/icon-unlock.png' < /home/xxx/Desktop/IconLockSet.desktop > /home/xxx/Desktop/tmp.desktop
   rm /home/xxx/Desktop/IconLockSet.desktop
   sed '/LockStatus=/ c\LockStatus=Unlocked' < /home/xxx/Desktop/tmp.desktop > /home/xxx/Desktop/IconLockSet.desktop
   rm /home/xxx/Desktop/tmp.desktop
else
 if grep -q "LockStatus=Unlocked" "/home/xxx/Desktop/IconLockSet.desktop"; then
    echo "It is UnLocked...we will Lock it"
    sed '/Icon=/ c\Icon=\/home\/xxx\/Linux_stuff\/Icons\/icon-lock.png' < /home/xxx/Desktop/IconLockSet.desktop > /home/xxx/Desktop/tmp.desktop
    rm /home/xxx/Desktop/IconLockSet.desktop
    sed '/LockStatus=/ c\LockStatus=Locked' < /home/xxx/Desktop/tmp.desktop > /home/xxx/Desktop/IconLockSet.desktop
    rm /home/xxx/Desktop/tmp.desktop
    sudo chattr +i ~/.config/xfce4/desktop/icons*
 fi

fi

exit

Note:
1) change xxx to your home folder name.
2) you will need a folder ~/scripts to put IconLockSet.sh in ( or change the
    code to your folder to suit )
3) you will need a folder ~/Linux_stuff/Icons to put the icons "icon-lock.png"
    and "icon-unlock.png" in ( or change the code to your folder to suit )
4) Go to the icon database and grab a couple of icons you want to use and
    put them in the ~/Linux_stuff/Icons folder ( or whatever folder you use ).
    Rename one "icon-lock.png" and rename the other "icon-unlock.png"
    ( I used the closed lock png for "icon-lock.png", it looks good )

Offline

#17 2014-08-10 15:44:20

rijnsma
Member
From: NL
Registered: 2011-09-05
Posts: 38

Re: Desktop icons rearrange on reboot

It is beautiful. Applaus.

Is there (as always in former days) also a normal way in Xfce to reproduce the position of icons after boot? smile

Last edited by rijnsma (2014-08-10 15:46:37)

Offline

#18 2014-09-14 03:24:52

sixwingsfire
Member
From: Ohio
Registered: 2014-09-06
Posts: 21

Re: Desktop icons rearrange on reboot

shakebake wrote:

Here is a kludge that I did. You are welcome to it if you want:


I tried that but when I click on the launcher I get this error message:
"Failed to execute child process "/home/jed/scripts/iconlockset.sh" (Permission denied)"

I'm wondering if it's because there are "sudo" commands in the script and it's not asking for my password??

Is there a way to make this work?

Has anyone figured out which one of these fixes or workarounds actually work (best)?

Thanks!

Offline

#19 2014-09-14 07:33:11

sixwingsfire
Member
From: Ohio
Registered: 2014-09-06
Posts: 21

Re: Desktop icons rearrange on reboot

UPDATE:

Through some research and self education on BASH, I found out how to make the script work.
For some reason, the 1st time I run a launcher that I create on the desktop, I get a message that reads "Untrusted application launcher" and the options to "Launch anyway", "Mark as executable", or "Cancel". Once I choose "Mark as executable" it launches fine and doesn't ask anymore.
For this script though, that didn't work. I had to go into the terminal and make it executable with "chmod +x".
Now it works fine.

Offline

#20 2014-09-14 19:58:11

sixwingsfire
Member
From: Ohio
Registered: 2014-09-06
Posts: 21

Re: Desktop icons rearrange on reboot

I believe I have formed a hybrid solution (workaround) derrived from the best answers given in this thread.
This works great for me. I'm running Ubuntu Studio 14.04 LTS and Xfce 4.10

In my opinion shakebake created a nice way to lock and unlock the desktop.
Here's a step by step rewrite of that with the addition of reloading the desktop after reboot:

Purpose:
To put an icon on your desktop that has a script that will lock/unlock your desktop icons so that they reload to the place you want them to be on reboot.

How it works:
Double click the icon to unlock. Enter your password in the terminal that pops up. Then set all desktop icons where you want them. Double click the icon again and enter password again to lock them down. Anytime you want to re-arrange them... unlock them, re-arrange, then lock them down again.

For the purpose of these instructions replace "xxx" with your home folder name.


Step 1
Create the needed directories:
Create a folder "/home/xxx/scripts"
Create the folders "/home/xxx/Linux_stuff/Icons"
(feel free to change the names and locations of the directories as you prefer as long as the script code and launcher directories are also changed accordingly)


Step 2
Create the Lock/Unlock script:
Save this script as "iconlockset.sh" in your "/home/xxx/scripts" folder.

#!/bin/bash

if grep -q "LockStatus=Locked" "/home/xxx/Desktop/IconLockSet.desktop"; then
   echo "It is Locked...we will Unlock it"
   sudo chattr -i ~/.config/xfce4/desktop/icons*
   sed '/Icon=/ c\Icon=\/home\/xxx\/Linux_stuff\/Icons\/icon-unlock.png' < /home/xxx/Desktop/IconLockSet.desktop > /home/xxx/Desktop/tmp.desktop
   rm /home/xxx/Desktop/IconLockSet.desktop
   sed '/LockStatus=/ c\LockStatus=Unlocked' < /home/xxx/Desktop/tmp.desktop > /home/xxx/Desktop/IconLockSet.desktop
   rm /home/xxx/Desktop/tmp.desktop
else
 if grep -q "LockStatus=Unlocked" "/home/xxx/Desktop/IconLockSet.desktop"; then
    echo "It is UnLocked...we will Lock it"
    sed '/Icon=/ c\Icon=\/home\/xxx\/Linux_stuff\/Icons\/icon-lock.png' < /home/xxx/Desktop/IconLockSet.desktop > /home/xxx/Desktop/tmp.desktop
    rm /home/xxx/Desktop/IconLockSet.desktop
    sed '/LockStatus=/ c\LockStatus=Locked' < /home/xxx/Desktop/tmp.desktop > /home/xxx/Desktop/IconLockSet.desktop
    rm /home/xxx/Desktop/tmp.desktop
    sudo chattr +i ~/.config/xfce4/desktop/icons*
 fi

fi

exit

Step 3
Create a launcher on the desktop:
Save this as "IconLockSet.desktop" in the folder "/home/xxx/Desktop"

[Desktop Entry]
Version=1.0
Type=Application
Name=IconLockSet
Comment=
Exec=/home/xxx/scripts/iconlockset.sh
Icon=/home/xxx/Linux_stuff/Icons/icon-lock.png
Path=/home/xxx/Desktop
Terminal=true
StartupNotify=false
LockStatus=Locked
GenericName=

Edit the launcher:

It should be named "IconLockSet"  ( no quotes )
The command should be: "/home/xxx/scripts/iconlockset.sh"  ( no quotes )
Make sure "run in terminal" is checked.


Step 4
Create the needed icons:
Go your icon folder ("/usr/share/icons") and grab a couple of icons you want to use and copy them into the newly created "/home/xxx/Linux_stuff/Icons" folder. Rename the one you want to use for locking the desktop to "icon-lock.png" and rename the other "icon-unlock.png"


Step 5
Important - Make sure the script is executable:
Open a terminal and enter: chmod +x /home/xxx/scripts/iconlockset.sh


Step 6
Create a script to reload the desktop on startup:
At this point the lock and unlock function will work but you would have to manually reload the desktop next time you login to make it remember the icon placement. To have this automatically happen at startup you need to go to the "Settings Manager"/"Session and Startup" and add an Application Autostart item.

Save this script as "reloaddesktop.sh" in your "/home/xxx/scripts" folder.

#!/bin/sh
sleep 13
xfdesktop --reload

If you have a lot of icons or if your desktop loads slow, you may have to increase the sleep time from 13 to something higher like 20 or 30.
I only have 5 icons and my desktop loads really fast so 13 works for me.


Step 7
Add the Application Autostart item:
Go to the "Settings Manager"/"Session and Startup". Click the "+ Add" button on the bottom left.
Name: ReloadDesktop
Description: Reloads the Desktop
Command: /home/jed/scripts/reloaddesktop.sh


Step 8 (final)
Important - Make sure the script is executable:
Open a terminal and enter: chmod +x /home/xxx/scripts/reloaddesktop.sh


That should do it :)
Hope this helps someone and can be referenced in the future on this forum.

Maybe the next version of Xfce could fix this issue... seems like it would be easy enough to include the option to lock the desktop icons somewhere in the Settings Manager. ;)


EDIT: Alternatively, you could try these patches (I have not tried them)

http://git.xfce.org/xfce/xfdesktop/comm … 165b648daf

http://git.xfce.org/xfce/xfdesktop/comm … 531f1c5d12

Last edited by sixwingsfire (2014-11-20 05:12:49)

Offline

#21 2014-11-18 08:24:30

Marc73
Member
Registered: 2014-11-18
Posts: 3

Re: Desktop icons rearrange on reboot

Hi,

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.

Offline

#22 2014-11-20 05:17:25

sixwingsfire
Member
From: Ohio
Registered: 2014-09-06
Posts: 21

Re: Desktop icons rearrange on reboot

Marc73 wrote:

Hi,

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.


Just to be sure I understand...
You are saying you can place your icons wherever you like, and when you reboot they are still where you placed them, simply by resizing your panel to 40 pixels? Just wanting to make sure we are talking about the same thing here... Xfce doesn't keep the icons where you place them if not in the default positions - that's the problem in the original post. Yours is a much better fix, if so.

Last edited by sixwingsfire (2014-11-20 05:18:05)

Offline

#23 2014-11-20 10:40:13

rijnsma
Member
From: NL
Registered: 2011-09-05
Posts: 38

Re: Desktop icons rearrange on reboot

Why exists this silly thing?

Offline

#24 2014-11-22 20:23:12

Marc73
Member
Registered: 2014-11-18
Posts: 3

Re: Desktop icons rearrange on reboot

sixwingsfire wrote:
Marc73 wrote:

Hi,

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.


Just to be sure I understand...
You are saying you can place your icons wherever you like, and when you reboot they are still where you placed them, simply by resizing your panel to 40 pixels? Just wanting to make sure we are talking about the same thing here... Xfce doesn't keep the icons where you place them if not in the default positions - that's the problem in the original post. Yours is a much better fix, if so.

Yes you are right.
In fact, xfce keeps the icons in the right place with most people. I wonder if this problem is not somehow connected to the fact that some people create an upper panel whose size somehow disturbs xfce. In my case, changing the size from 32 to 40 pixels solved the problem. This might be different depending on the size of your screen.

I suggest you try if the problem disappears without upper panel. If taht succeeds, try with different sizes.

Hope this will help.

Offline

#25 2015-06-03 10:23:17

wergo
Member
Registered: 2015-06-03
Posts: 2

Re: Desktop icons rearrange on reboot

I have the same problem with vertical panels... The solution & scripts by sixwingsfire based on shakebake's post are very elegant, easy to use & they work outstandingly for me on Mint 17.1 with the 4.12.0-1 desktop!

Many thanks

R.

Offline

Board footer

Powered by FluxBB