Page 1 of 1

Problem with fixdesktopicons in Bash

Posted: Sun 01 Nov 2009, 11:07
by trio
Hi,

I am in the middle of making a new bash program which main goal is to re-align desktop icons vertically and horizontally (see pics below, before and after). It is useful when you put new icons on desktop.

I am successful in aligning vertically and my next thing to do is horizontal alignment (which I think I can manage). But a problem persists, Icons on first line is always moved to the fifth line.

Assistance needed, I am confused.

Thanks

Posted: Sun 01 Nov 2009, 11:25
by 01micko
That's a good idea! But I haven't a clue at this stage...

I'm sure ttuuxxx would know..

Cheers

Posted: Sun 01 Nov 2009, 13:00
by trapster
Should 390 be 399?

Code: Select all

if [[ $(echo {201..299}) =~ $y ]] ; then 
ynew='"'224'"'
fi

if [[ $(echo {300..390}) =~ $y ]] ; then 
ynew='"'320'"'
fi

if [[ $(echo {400..480}) =~ $y ]] ; then 
ynew='"'416'"'
fi

Posted: Sun 01 Nov 2009, 13:57
by MinHundHettePerro
Hello! :)

For example, y=32 will test true in all the [[ ... ]]'s,

a workaround could be to re-phrase the tests, like e.g.

Code: Select all

if [[ $(echo " "{8..100}" ") =~ " $y " ]] ; then
hth :)/
MHHP

Posted: Sun 01 Nov 2009, 14:04
by zigbert
Hello trio
Long time....good to see you!!!

The answer is simply to reorder you ifs

Code: Select all

for y in `cat /root/Choices/ROX-Filer/PuppyPin | grep "</icon>" | cut -d "y" -f2 | cut -d '"' -f2 | sort -n`
do 

if [[ $(echo {101..200}) =~ $y ]] ; then 
ynew='"'128'"'
fi

if [[ $(echo {201..299}) =~ $y ]] ; then 
ynew='"'224'"'
fi

if [[ $(echo {300..390}) =~ $y ]] ; then 
ynew='"'320'"'
fi

if [[ $(echo {400..480}) =~ $y ]] ; then 
ynew='"'416'"'
fi

if [[ $(echo {481..580}) =~ $y ]] ; then 
ynew='"'512'"'
fi

if [[ $(echo {581..$END}) =~ $y ]] ; then 
ynew='"'608'"'
fi

if [[ $(echo {8..100}) =~ $y ]] ; then 
ynew='"'32'"'
fi

if [[ $(echo {$BOTTOM..~}) =~ $y ]] ; then 
ynew='"'$BOTTOM'"'
fi

Sigmund

Posted: Sun 01 Nov 2009, 15:03
by trio
Thanks!!!