Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 [2] 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Icon Grid Aligning< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Nov. 16 2007,22:22 QUOTE

Well, I still have uses for the xpm viewer besides desktop icons, such as images for application interfaces (skins, for example).
ImageMagick is a vital tool for anyone who does graphics work.

Quote
have .dfminfo be plain text and no gzipped.
I never noticed that. Good move =o)
I wonder if that allows manual (persistent) edits of the file while dfm is running?


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Nov. 17 2007,01:43 QUOTE

Thanks roberts, the extra code seems to do the trick.
dfm is constantly updating .dfminfo. Fortunately the script is fast
enough to change it, although I'm not sure what other side efffects
may happen.
Unless dfm allows running calls to itself, I'm not sure how I can
interface with it using c code. Meanwhile here is the update for
those who want to play around with it.

******** Warning -- This works for 4.1RC1 !!! ******************
********       any less version will corrupt your .dfminfo !!! ****

Code Sample

#!/bin/lua

x_align = 56
y_align = 64

x_mid   = math.floor(x_align/2);
y_mid   = math.floor(y_align/2);

fin  = assert(io.open("/home/dsl/.dfminfo", "r"))
fout = assert(io.open("/home/dsl/modified.dfminfo", "w"))

count = 1

while true do
line = fin:read()
if line == nil then break end

pattern = "_POS"
i= string.find (line, pattern)
if i then -- if possible candidate
 s = string.sub(line, i+6)

 from,till,x,y = string.find (s, "%s*(%d+)%s*(%d+)")
 if (x and y) then -- if candidate
 
  mod = math.mod (x, x_align)
  x = x - mod
  if  mod > x_mid then
   x = x + x_align;
  end
  mod = math.mod (y, y_align)
  y = y - mod
  if  mod > y_mid then
   y = y + y_align;
  end

  s=string.sub (line, 1, i+5) -- the start of the line
  fout:write (s,x," ",y, "\n") -- the modification
 else
  fout:write (line, "\n") -- unaltered candidate
 end

 count = count + 1
else
 fout:write (line, "\n") -- unaltered non-candidate
end
end

fin:close ()
fout:close ()

os.execute ("mv -f /home/dsl/modified.dfminfo /home/dsl/.dfminfo")
os.execute ("pkill dfm && dfm") -- restart dfm

Back to top
Profile PM 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Nov. 19 2007,17:43 QUOTE

I haven't tried this, since I'm still using 4.0.  I just tried the present "arrange" feature, which appears to snap icons in line without re-arranging.  What's different?  Thanks
Back to top
Profile PM 
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Nov. 19 2007,18:06 QUOTE

the "arrange" feature arranges and snaps (so named 'arrange'). To see this, drag an
icon to the middle of the screen, do 'arrange' and it gets moved back near the rest of
the icons. for some of us, we like to divide out icons in different areas of the screen
but also want the 'snap' to an imaginary grid.
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Nov. 20 2007,00:19 QUOTE

I wonder why you are creating and writing to modified.dfminfo? Apparently this file overwrites .dfminfo immediately anyway, so is there a reason not to write directly to .dfminfo?

You could also (optionally) use io.popen("file .dfminfo") to check whether it is gzipped before writing to it. This could allow you to write to a tempfile, then gzip it if needed before overwititng the original.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
11 replies since Nov. 16 2007,01:17 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: Icon Grid Aligning

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code