Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-13-2010, 01:37 PM   #1
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,665

Rep: Reputation: 487Reputation: 487Reputation: 487Reputation: 487Reputation: 487
How to Auto-arrange Desktop Icons

I just thought this would be helpful to most newbies migrating from windows to Gnu/Linux: familiar with Right-click >> Arrange-icons-automatically, while under my KDE & XFCE this feature is something I wanted.

This code is not mine: I only copied this from where I found, from the ubuntuforums authored by a member logged as user PGScooter, you may read him/her directly from here.


Copy the following code:

#make sure you change 'user' on line 4 to the username of the desktop you want to organize
use strict;
use warnings;
my $conffile='/home/user/.config/xfce4/desktop/icons.screen0.rc';
open(CONF,"$conffile") or die "can't find the config file";
my $all;
while (<CONF>) {
my @oldnames=($all=~/\[(.*)\]/g);
my @allnames=sort { lc($a) cmp lc($b) } @oldnames;
print "testing sort:";
print join("\n",@allnames);
my @rows=($all=~/row=(\d*)/g);
print join("\n",@allnames);
print "ok now I will print the amount of rolls\n\n\n";
my $maxrow=$rows[-1];
print "the max rows is $maxrow";
my $numicons=scalar(@allnames);
print "number of icons is $numicons";
my @cols=($all=~/col=(\d*)/g);
my $maxcol=$cols[-1];
print "the max cols is $maxcol";
my $i=0;
for (my $j=0;$j<=$maxcol;$j++) {	
	if ($i<=19) {
		for (my $k=0;$k<=$maxrow;$k++) {
			print OUTPUT "\[$allnames[$i]\]\nrow=$k\ncol=$j\n\n";
Be sure to change the /home/YOURNAME-here/.... to your user name in the ~/ directory.

Paste the code into an editor and save it into your home folder as /home/user/.config/xfce4/desktop/icons.screen0.rc

{if you run Kde you may replace that xfce4 to kde whatever is found in your current directory.

Log out. Log in as that user again. The icons are arranged this time. It worked for me automatically. I am running Xfce4 over a Slackware 12.2.

Hope this helps. Good luck.

Last edited by malekmustaq; 08-13-2010 at 01:39 PM.
Old 08-15-2010, 02:41 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
And next time you find a solution (rather than have a question)
please post it in the tutorial section
Old 08-16-2010, 07:50 AM   #3
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,665

Original Poster
Rep: Reputation: 487Reputation: 487Reputation: 487Reputation: 487Reputation: 487

I didn't know this would qualify into a tutorial either; much the consciousness that the material is not mine.

Anyway thanks. I hope I can contribute a true tutorial someday, and yes I shall do it there.


desktop, icons

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Song icons on Desktop will auto-play when mouse hovered over them NOoBuntuLinux Linux - Newbie 3 11-27-2008 10:09 PM
how to create and remove desktop icons or icons from shell scripts? kkpal Linux - Newbie 7 09-01-2008 11:04 AM
Desktop icons dosnt have ToolTips (apear when mouse hover above desktop icon) Acidx Linux - General 1 12-03-2006 08:48 PM
Gnome - Auto Arrange (Clean Up By Name) on startup mrclisdue Linux - Desktop 0 09-06-2006 06:53 AM
KDE icon auto arrange settings dravenloft Linux - Software 6 07-26-2006 10:12 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration