Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 01 Aug 2014, 18:56
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Problem with fixdesktopicons in Bash
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
trio


Joined: 21 Dec 2008
Posts: 1788
Location: अनुमोदना

PostPosted: Sun 01 Nov 2009, 07:07    Post subject:  Problem with fixdesktopicons in Bash  

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
before.jpg
 Description   
 Filesize   18.57 KB
 Viewed   612 Time(s)

before.jpg

after.jpg
 Description   
 Filesize   17.46 KB
 Viewed   621 Time(s)

after.jpg

Icons_line_moved.jpg
 Description   
 Filesize   31.21 KB
 Viewed   617 Time(s)

Icons_line_moved.jpg

fixdesktopicons.tar.gz
Description 
gz

 Download 
Filename  fixdesktopicons.tar.gz 
Filesize  485 Bytes 
Downloaded  369 Time(s) 

_________________
PET Maker|WbarCC|My Website
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7785
Location: qld

PostPosted: Sun 01 Nov 2009, 07:25    Post subject:  

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

I'm sure ttuuxxx would know..

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
trapster


Joined: 28 Nov 2005
Posts: 1999
Location: Maine, USA

PostPosted: Sun 01 Nov 2009, 09:00    Post subject:  

Should 390 be 399?

Code:
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: Puppeee4.31 + 1.0, Puppy4.10 + Lupu52
Currently using Slacko AND lupu52 w/ fluxbox
Back to top
View user's profile Send private message Visit poster's website 
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 847
Location: SE

PostPosted: Sun 01 Nov 2009, 09:57    Post subject:  

Hello! Smile

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

a workaround could be to re-phrase the tests, like e.g.
Code:
if [[ $(echo " "{8..100}" ") =~ " $y " ]] ; then

hth Smile/
MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5654
Location: Valåmoen, Norway

PostPosted: Sun 01 Nov 2009, 10:04    Post subject:  

Hello trio
Long time....good to see you!!!

The answer is simply to reorder you ifs
Code:

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
trio


Joined: 21 Dec 2008
Posts: 1788
Location: अनुमोदना

PostPosted: Sun 01 Nov 2009, 11:03    Post subject:  

Thanks!!!
_________________
PET Maker|WbarCC|My Website
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0533s ][ Queries: 12 (0.0040s) ][ GZIP on ]