Changing wallpaper via fluxbox menu


Results 1 to 6 of 6

Thread: Changing wallpaper via fluxbox menu

  1. #1
    Join Date
    Nov 1999
    Location
    Williston, Florida
    Posts
    117

    Changing wallpaper via fluxbox menu

    I've been trying to figure out how to do this withought using the fluxbox-generate_menu script, because the script adds a bunch of unnecessary clutter and I only like to have certian programs in the menu. I searched the fluxbox documentation and man pages, but I finally found what I needed in the fluxbox 0.9.10 changelog.

    * [wallpapers] (directory) {rootcommand}
    creates a submenu in the menu to click on the wallpaper one wants. default rootcommand is fbsetbg. This works great!

    Now I just need to find out how to get it to sort the wallpaper so it shows a different menu for each x number of wallpapers like the fluxbox-generate_menu script. For example:

    wallpaper1 > 1.jpg
    2.jpg
    3.jpg
    etc...
    wallpaper2 > 4.jpg
    5.jpg
    6.jpg
    etc...

    I would like to do this without doing it the obvious way, which is to seperate my wallpapers into different directories.

  2. #2
    Join Date
    May 2004
    Location
    TEXAS !!!!
    Posts
    244
    That's cool .. thanks for the tip.

    [edit] apparently I need to upgrade fluxbox .. I'm on version 0.9.9-1 .. so close [/edit]

    If the generate script splits the menus up, why not backup your current menu and run the script. Then see how they did it and copy back your original menu.
    Last edited by davisfactor; 02-11-2005 at 07:40 PM.

  3. #3
    Join Date
    Nov 1999
    Location
    Williston, Florida
    Posts
    117
    I ran the script as you suggested and the results were surprising. They use a completely different method which would take forever to do manually. I may look at which part of the script does this and try and make a standalone script. Here is an attachment of the section of the generated menu which sets the backgrounds.
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 1999
    Location
    Williston, Florida
    Posts
    117
    I found the section of the script that handles this, however I have very little experience in writing shell scripts. Here is an attachment.
    Attached Files Attached Files

  5. #5
    Join Date
    May 2004
    Location
    TEXAS !!!!
    Posts
    244
    First, I'm no programmer.

    Second, I spent a little time and came up with my own wallpaper menu generating script.

    Thirdly, I didn't really understand the one you posted, so I'm glad I was already working on my own when you posted it.

    Fourthly, here's my script:

    Code:
    davis@davis:[~/.fluxbox]: cat ../bin/gen_walls.sh 
    #!/bin/bash
    
    wallpaper_directory=/home/davis/wallpaper;
    menu=/home/davis/backgrounds.menu;
    
    x=0;
    menusize=10;
    bg_counter=1;
    
    echo -e "    [nop] (-------------) {}" >> $menu
    
    for i in $(ls -1 $wallpaper_directory); 
      do 
      {
        if [ $x = 0 ]
          then
            echo -e "  [submenu] (Backgrounds $bg_counter) {Set the Background}" >> $menu
            bg_counter=$(expr $bg_counter + 1)
        fi
    
            echo -e "    [exec] ($i) {fbsetbg -a \"$wallpaper_directory/$i\"}" >> $menu
            x=$(expr $x + 1)
    
        if [ $x -eq $menusize ]
          then
            echo -e "  [end]" >> $menu
            x=0
        fi
      }
    done
    
    if [ -z "$(tail -1 $menu | grep \"[end]\")" ]
      then
        echo -e "  [end]" >> $menu
        echo -e "    [nop] (-------------) {}" >> $menu
    fi
    I'm sure this could have been done better by a more experienced scripter, but my version works just fine.

    All you'll really need to change are the two lines at the top. After you've generated the file, just copy and paste it into your .fluxbox/menu file.

    I recommend making a backup of your menu file first so it will be easy to recover from any mistakes.

    Hope this helps! Let me know if you have any problems with it but it works great on my system!!!

    Again, thanks for the tip, I'm going to start using this.
    Last edited by davisfactor; 02-11-2005 at 10:06 PM.

  6. #6
    Join Date
    May 2004
    Location
    TEXAS !!!!
    Posts
    244
    You can't really tell, but just to be specific:

    The -1's in these lines are ones, not L's

    for i in $(ls -1 $wallpaper_directory);
    if [ -z "$(tail -1 $menu | grep \"[end]\")" ]

    Just wanted to point that out because, especially the ls -1, can cause the program to not work if an L is used instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •