xfce4桌面没有自动排列的功能,如果文件多了,超出了桌面的范围,就不好找了,在网上发现个perl脚本,比较好用,拿过来用用。
#!/usr/bin/perl
use strict;
use warnings;
my $conffile='/home/jesse/.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:\n";
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;
print "conffile: $conffile"
open(OUTPUT,">$conffile");
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);
|
运行脚本
阅读(1218) | 评论(0) | 转发(0) |