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: set wallpaper< Next Oldest | Next Newest >
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Dec. 09 2007,06:25 QUOTE

i didn't know xsri was so versatile.
here is the final script to wrap up.

/home/dsl/.dfmdesk/wallpaper/set_wallpaper
Code Sample


#!/bin/bash

#set_wallpaper <file>

#copy the wallpaper to a file called 'default' inside the desktop wallpaper folder and load it.
#if no <file> is given, just reload 'default'

if [ "$1" != "" ]; then
cp $1 /home/dsl/.dfmdesk/wallpaper/default
fi

xsri \
--color=black \
--scale-width=100 --scale-height=100 \
--keep-aspect \
--emblem \
/home/dsl/.dfmdesk/wallpaper/default \

# xsri options
# --scale-width=100 --scale-height=100 \
# --center-x --center-y \
# --keep-aspect \
# --color=black \
# --emblem=<image> \
# --emblem-alpha [0-255] \
# --tile=<image> \
# --tile-alpha [0-255] \
# --emboss \
# --geometry=[wxh][+x+y] \
# --color=#226622 \
# --color2=black \
# --vgradient \
# --hgradient \


drag the file from a dfm folder onto the set_wallpaper icon.

and don't forget to call set_wallpaper from your window manager .inc file for startup.
Back to top
Profile PM 
humpty Offline





Group: Members
Posts: 655
Joined: Sep. 2005
Posted: Jan. 01 2008,03:57 QUOTE

Below is a lua version of my wallpaper/background loader I did over the hols (yeh yeh, you can tell I don't have a life).

I may have gone a bit overboard here with the dragNdrop concept but basically set_wallpaper now allows commands either embedded in the filename or solo dragNdrop commands.

So you can drop files named e.g mypic--reset--full-screen--keep-aspect.jpg

Or you can individually dragNdrop e.g
mypic.jpg
++full_screen
++keep-aspect

or highlight a few ++cmds to drop.

The commands accumalate and are saved to default.opts and re-used until a '++reset' or '--reset' is issued.

Just put this file in /home/dsl/.dfmdesk/wallpaper folder and run 'set_wallpaper __make' to make the solo (++)commands.

Read the end of the file to see the commands supported.

Also include '/home/dsl/.dfmdesk/wallpaper/set_wallpaper' in .xinitrc before the last line to load wallpaper at boot.

(the default wallpaper is now called 'current')

Code Sample

#!/bin/lua

-- set_wallpaper [file] [file--with-commands] [++solo-commands]

-- current pic is called 'current'
-- use cmd '++make' to make solo cmd files for dragNdrop
-- last settings are kept in 'default.opts', use cmd '++reset' to clear
-- --------------------------------------------------------------------------
-- functions

function reset_defaults ()
-- note: if you edit these defaults, required is a space before the cmd
scalex  = ""
scaley  = ""
aspect  = ""
centerx = ""
centery = ""
color   = ""
color2  = ""
grad    = ""
tile    = ""
opts    = ""
end

function process_cmds (cmd)
-- tailored cmds
if (string.find (cmd, "--reset")) then  
 reset_defaults ()
 print ("defaults reset")
end
if (string.find (cmd, "--full%-screen")) then
scalex=" --scale-width=100"
scaley=" --scale-height=100"
end
if (string.find (cmd, "--full%-x"))    then scalex=" --scale-width=100" end
if (string.find (cmd, "--full%-y"))    then scaley=" --scale-height=100" end
if (string.find (cmd, "--black"))    then color= " --color=black" end

-- standard xsri cmds (no parameters)
if (string.find (cmd, "--keep%-aspect")) then aspect  = " --keep-aspect" end
if (string.find (cmd, "--center%-x"))    then centerx = " --center-x" end
if (string.find (cmd, "--center%-y"))    then centery = " --center-y" end
if (string.find (cmd, "--hgradient"))    then grad    = " --hgradient" end
if (string.find (cmd, "--vgradient"))    then grad    = " --vgradient" end
if (string.find (cmd, "--tile"))      then tile    = " --tile" end

-- cmds which require parameters
s,e,x = string.find (cmd, "--scale%-width=(%d+)")
if x then scalex = " --scale-width="..x end
s,e,y = string.find (cmd, "--scale%-height=(%d+)")
if y then scaley = " --scale-height="..y end

s,e,c = string.find (cmd, "--color=([#%w]+)")
if c then color = " --color="..c end
s,e,c = string.find (cmd, "--color2=([#%w]+)")
if c then color2 = " --color2="..c end

end --process_cmds
-- --------------------------------------------------------------------------
-- main

wcmd = ""
i=1
while arg[i] ~= nil do
wcmd = wcmd.." "..arg[i]
i=i+1
end

if wcmd == " ++make" then
os.execute ("touch ++black ++full-screen ++full-x ++full-y ++keep-aspect ++center-x ++center-y ++tile ++reset")
os.exit(0)
end

-- are these solo cmds or embedded in the filename ?
if (string.find (wcmd, "++") or wcmd == "") then
wcmd = string.gsub (wcmd, "++", "--")
solo=true
else solo=false
end

-- load any filename, and copy it to 'current'
if not solo then
os.execute ("cp "..wcmd.." /home/dsl/.dfmdesk/wallpaper/current")
else print ("solo")
end

reset_defaults ()

--load default opts
fin=io.open("/home/dsl/.dfmdesk/wallpaper/default.opts", "r")
opts=fin:read()
fin:close ()

-- process default opts
print ("defaults:"..opts)
process_cmds (opts)

-- add input opts
print ("inputs  :"..wcmd)
process_cmds (wcmd)

opts=scalex..scaley..aspect..centerx..centery..color..color2..grad..tile
print ("final   :"..opts)

-- load current pic
os.execute ("xsri "..opts.." /home/dsl/.dfmdesk/wallpaper/current")

-- save as default opts
fout=io.open("/home/dsl/.dfmdesk/wallpaper/default.opts", "w")
fout:write (opts, "\n")
fout:close ()

--tailored command options
-- ++full-screen
-- ++full-x
-- ++full-y
-- ++black

-- xsri options implemented (see xsri --help for reference)
-- --scale-width=100 --scale-height=100
-- --center-x --center-y
-- --keep-aspect
-- --tile
-- --color=#226622 --color2=black
-- --vgradient --hgradient

-- xsri options not yet implemented
-- --emblem=file
-- --emblem-alpha [0-255]
-- --geometry=[wxh][+x+y]
-- --tile-alpha [0-255]
-- --emboss
Back to top
Profile PM 
11 replies since Dec. 01 2007,16:48 < 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: set wallpaper

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