Content added Content deleted
imported>Finn mNo edit summary |
imported>Finn mNo edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
<menu id="client-list-menu" /> |
<menu id="client-list-menu" /> |
||
<separator /> |
<separator /> |
||
'''<menu id="wallpapers" label="wallpapers" execute=" |
'''<menu id="wallpapers" label="wallpapers" execute="/home/finn/.config/openbox/wallpaper.py" />''' |
||
- <item label="ObConf"> |
- <item label="ObConf"> |
||
... |
... |
||
Line 15: | Line 15: | ||
===/home/finn/.config/openbox/wallpaper.py :=== |
===/home/finn/.config/openbox/wallpaper.py :=== |
||
<pre> |
|||
#!/usr/bin/python |
#!/usr/bin/python |
||
Line 21: | Line 23: | ||
wallpapers = glob.glob('/home/finn/pictures/wallpaper/*').sort() |
wallpapers = glob.glob('/home/finn/pictures/wallpaper/*'); wallpapers.sort() |
||
#wallpapers.sort() |
#wallpapers.sort() |
||
print '<openbox_pipe_menu>' |
print '<openbox_pipe_menu>' |
||
Line 31: | Line 33: | ||
</item>''' % (name, pic) |
</item>''' % (name, pic) |
||
print '</openbox_pipe_menu>' |
print '</openbox_pipe_menu>' |
||
</pre> |
|||
===creates:=== |
|||
<pre> |
|||
⚫ | |||
<item label="world.jpg"> |
|||
===''python wallpaper.py''=== gives me: |
|||
<action name="Execute"><execute>Esetroot -scale /home/finn/pictures/wallpaper/world.jpg</execute></action> |
|||
</item> |
|||
</openbox_pipe_menu> |
|||
</pre> |
|||
⚫ | |||
Trackback (most recent call last): |
|||
File "wallpaper.py", line 9, in = |
|||
for pic in wallpapers: |
|||
TypeError: iteration over non-sequence |
|||
===but the "wallpapers" submenu is still empty=== |
|||
__NOTOC__ |
__NOTOC__ |
Latest revision as of 21:41, 25 July 2005
wallpapers are in /home/finn/pictures/wallpaper[edit]
[edit]
... <menu id="Debian" /> <separator /> <menu id="client-list-menu" /> <separator /> <menu id="wallpapers" label="wallpapers" execute="/home/finn/.config/openbox/wallpaper.py" /> - <item label="ObConf"> ...
/home/finn/.config/openbox/wallpaper.py :[edit]
#!/usr/bin/python # Generates a dynamic menu import glob wallpapers = glob.glob('/home/finn/pictures/wallpaper/*'); wallpapers.sort() #wallpapers.sort() print '<openbox_pipe_menu>' for pic in wallpapers: name = pic.split('/')[-1] print ''' <item label="%s"> <action name="Execute"><execute>Esetroot -scale %s</execute></action> </item>''' % (name, pic) print '</openbox_pipe_menu>'
creates:[edit]
<openbox_pipe_menu> <item label="world.jpg"> <action name="Execute"><execute>Esetroot -scale /home/finn/pictures/wallpaper/world.jpg</execute></action> </item> </openbox_pipe_menu>