Nieuws:

Ubuntu-NL weer online!

Na een periode van technische problemen en een overbelaste server zijn we eindelijk weer bereikbaar.
Samen met Hobbynet, onze sponsor en hostingpartner, hebben we een oplossing gevonden zodat alles weer soepel draait.

Bedankt voor jullie geduld en begrip. We hopen nu weer verder te gaan waar we gebleven waren.

Het team van Ubuntu-NL

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: Burobladiconen sorteren op type.  (gelezen 1392 keer)

Offline 80b.baron

  • Lid
Burobladiconen sorteren op type.
« Gepost op: 2009/11/27, 14:30:07 »
Ubuntisten,

Ik zoek een manier om mijn iconen op het buroblad te sorteren op type ipv op naam.
Klikt men recht op het buroblad dan verschijnt in het geopende meny "opschonen op naam"
Zou het niet prachtig zijn om hier meerder mogelijkheden te hebben zoals:

Op Type of Automatisch rangschikken.

dit is wat ik op een Engelstalig Ubuntuforum vond:


Re: How can I change location of desktop icons ?
Hey guys, I keep seeing this thread pop up occasionally, and one user wrote a perl script for it, but it was more of his/her own quick-n-dirty, so I thought I'd bust one out with some in-depth comments in case you want to use it. This script will just automatically arrange the icons starting in the upper left, in no particular order, except that 'Home', 'File System', and 'Trash' will be the first 3 icons down the left-hand side.
If you'd like some changes, such as order by type, alphabetically, etc, just let me know, and I'll be happy to make the changes (or you can play with it and pick up a very important tool - Perl... ;o)
Anyway, here it is:

Code:

#!/usr/bin/perl

######################################################
## Script to automatically arrange desktop icons, starting in the upper left. This can be run hourly from crontab like so:
## 0 *     * * *   <username>    /usr/local/bin/icon_arrange.pl
## And/Or it can be placed in rc.local to run on every reboot. I don't reboot my machine very often, to I use the crontab option.
######################################################

use strict;
use File::Copy;

## might be multiple users, find out who's using the current x-session-manager
my @user = `ps aux|egrep 'x-session-manager'|grep -v egrep`;
chomp(@user[0]);
@user[0] =~ s/^(\w+)\s.*?$/$1/g;
my $user = @user[0];

## find out the location of the file (helps across distributions/updated kernels, etc...)
my $icons_file = `locate icons|grep desktop|grep screen0`;
chomp($icons_file);

## just in case there are multiple users, set the /home/<user>/ to the $user variable:
$icons_file =~ s/^\/home\/\w+\//\/home\/$user\//g;

## finally, we now have the right file, make a backup & proceed with parsing it:
copy("$icons_file", "$icons_file.bak");

open(CONFIG, "<$icons_file") or die("Can't open $icons_file for reading!!");
my @icon_config = <CONFIG>;
close(CONFIG);

## grab all the icon names on the desktop. Don't care about their positions, since I'm giving them new ones:
my @icons;
foreach my $line (@icon_config) {
   if ($line =~ /^(\[.*?\])$/) { push(@icons, $1) }
}

## open the new config file to write to it:
open(NEWCONFIG, ">$icons_file") or die("Can't open $icons_file for writing!!");

## I personally prefer 'Home' at the top left, then 'File System' underneath it, then 'Trash', then so on...
print NEWCONFIG "[Home]\nrow=0\ncol=0\n
[File System]\nrow=1\ncol=0\n
[Trash]\nrow=2\ncol=0\n\n";

my $row_count = 3;
my $col_count = 0;

foreach my $icon (@icons) {
## on my particular desktop (1280x2048 dual monitor) there are 9 rows... Not sure how this plays out for lower resolutions...
## so here I incremement the row count on each loop until it reaches 9, then reset it to 0 and increment the col count up 1:
   if ($row_count > 9) { $row_count = 0; $col_count++ }
   if ($icon !~ /^(\[Home\]|\[File System\]|\[Trash\])$/) { print NEWCONFIG "$icon\nrow=$row_count\ncol=$col_count\n\n"; }
   $row_count++;
}


Dit is dus chinees!

of nog een andere oplossing



#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>) {
   $all=$all.$_;
}
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";
@rows=sort(@rows);
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);
@cols=sort(@cols);
my $maxcol=$cols[-1];
print "the max cols is $maxcol";
my $i=0;
open(OUTPUT,'>icons.screen0.rc');
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";
         $i++;
      }
   }
}
close(OUTPUT);


Dit is dus Japanees!


Iemand die dit aan een beginner kan verduidelijken?

Met Dank,

80b.



Re: Burobladiconen sorteren op type.
« Reactie #1 Gepost op: 2009/11/27, 14:32:20 »
http://forum.ubuntu-nl.org/software-en-configuratie/iconen-overlappen/msg518361/#msg518361
als je in nautilus naar /home/Bureaublad gaat kun je daar met een rechtermuisklik kiezen voor Items Rangschikken : Op Type

test misschien eerst even de bovenstaande oplossing uit. Lijkt me iets simpeler

Offline 80b.baron

  • Lid
Re: Burobladiconen sorteren op type.
« Reactie #2 Gepost op: 2009/11/27, 23:41:44 »
als je in nautilus naar /home/Bureaublad gaat kun je daar met een rechtermuisklik kiezen voor Items Rangschikken : Op Type

Beste Schwarzproductions,
 
Zover was ik ook gekomen maar ik had het eigenlijk over de iconen op het Bureaublad.
Je mag In Nautilus nog zovel veranderen wat je wil maar als je dan teruggaat naar je Desktop staat alles nog als vanouds.
Toch bedankt voor de moeite.

Ik zie bij jou een dj-avatar, werk je met djsoftware in Ubuntu? Welke?
Groeten,

Re: Burobladiconen sorteren op type.
« Reactie #3 Gepost op: 2009/11/28, 13:03:50 »
Ik zie bij jou een dj-avatar, werk je met djsoftware in Ubuntu? Welke?
Groeten,
Ik gebruik Mixxx onder Ubuntu. Het programma werkt goed, maar het kan nog wat beter vind ik.