Originally Posted by
underkz
Hi guys,
I'm wondering if we can kind of "lock icons" on the desktop so they will not change positions when I play a 800*600 game.
You know, when you have icons near the left side of your screen and after playing a game your icons are all smashed to the right side of the screen.
Any clues? Thank's
Finally I came up with decent solution for this.
1. Create following script, save it to your home folder as "RunPreservingIconPos" and make it runnable.
Code:
#!/bin/bash
cd ~/.config/xfce4/desktop/
cp -f ./icons.screen0-1280x1024.rc ./icons.screen0-1280x1024.rc_bak
# This will launch application given as argument (as background process).
$1 &
sleep 1
# This will get PID of the application (if it launches multiple processes this script might not work).
PID=`jobs -p`
echo "Looking for process which has pid of $PID."
# Let's wait until ps doesn't see the process anymore.
while [ ! -z `ps -p $PID -o pid=` ]; do
sleep 1
done
echo "Execution of the process ended."
cd ~/.config/xfce4/desktop/
# These lines forces new configs to be read (apparently by flushing some config cache).
rm ./icons.screen0-1280x1024.rc
xfdesktop --reload
# Wait and restore backed up configs.
sleep 1
cp -f ./icons.screen0-1280x1024.rc_bak ./icons.screen0-1280x1024.rc
xfdesktop --reload
NOTE! Rename all of these "icons.screen0-1280x1024.rc" filenames in the script to correspond to your resolution in use!
2. Modify all problem application launchers to start with the script, example:
/usr/games/sauerbraten
--->
/home/<yourusername>/RunPreservingIconPos sauerbraten
3. Done. After one second you exit the application, all your icons will be just where you wanted.
If you find it useful, please share it.
Bookmarks