Problem with fixdesktopicons in Bash

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
trio
Posts: 2076
Joined: Sun 21 Dec 2008, 15:50
Location: अनà¥￾मोदना

Problem with fixdesktopicons in Bash

#1 Post 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
Attachments
before.jpg
(18.57 KiB) Downloaded 745 times
after.jpg
(17.46 KiB) Downloaded 749 times
Icons_line_moved.jpg
(31.21 KiB) Downloaded 671 times
fixdesktopicons.tar.gz
(485 Bytes) Downloaded 615 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#2 Post by 01micko »

That's a good idea! But I haven't a clue at this stage...

I'm sure ttuuxxx would know..

Cheers
Puppy Linux Blog - contact me for access

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#3 Post 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
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
MinHundHettePerro
Posts: 852
Joined: Thu 05 Feb 2009, 22:22
Location: SE

#4 Post 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
[color=green]Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285[/color]
Slackos & 214X, ... and Q6xx
[color=darkred]Nämen, vaf....[/color] [color=green]ln -s /dev/null MHHP[/color]

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#5 Post 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

User avatar
trio
Posts: 2076
Joined: Sun 21 Dec 2008, 15:50
Location: अनà¥￾मोदना

#6 Post by trio »

Thanks!!!

Post Reply