×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    User:Finn/openbox: Difference between revisions

    Content added Content deleted
    imported>mutante
    imported>Finn
    mNo edit summary
     
    (3 intermediate revisions by the same user not shown)
    Line 9: Line 9:
    <menu id="client-list-menu" />
    <menu id="client-list-menu" />
    <separator />
    <separator />
    '''<menu id="wallpapers" label="wallpapers" execute="~/home/finn/.config/openbox/wallpaper.py" />'''
    '''<menu id="wallpapers" label="wallpapers" execute="/home/finn/.config/openbox/wallpaper.py" />'''
    - <item label="ObConf">
    - <item label="ObConf">
    ...
    ...
    Line 23: 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 35: Line 35:
    </pre>
    </pre>


    ===creates:===
    ===''[[python]] wallpaper.py''=== gives me:


    <pre>
    <openbox_pipe_menu>

    Trackback (most recent call last):
    <openbox_pipe_menu>
    File "wallpaper.py", line 9, in =

    for pic in wallpapers:
    <item label="world.jpg">
    TypeError: iteration over non-sequence
    <action name="Execute"><execute>Esetroot -scale /home/finn/pictures/wallpaper/world.jpg</execute></action>
    </item>
    </openbox_pipe_menu>

    </pre>


    ===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]

    the menu.xml entry:[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>
    
    

    but the "wallpapers" submenu is still empty[edit]

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.