Jessica Fae (jessica_fae) wrote,
Jessica Fae
jessica_fae

  • Mood:

The finished product.

Ok, so here is an update to the code. The last Ruby code posted was very early, and very sketchy. Here is my streamlined version of it.:

class Menu

def to_s
File::open(“#{ENV[’HOME’]}/.fluxbox/imagemenu”, “w”) do |f|
f.puts “[submenu] (Backgrounds) {#{ARGV[0]}}”
f.puts “\t[exec] (Update Backgrounds) {makeimagemenu.rb \”#{ARGV[0]}\“}”
Dir::entries(“#{ENV[’HOME’]}/.fluxbox/backgrounds”).select{|i| i !~/^\./}.sort{|a,b| a.downcase <=> b.downcase}.each do |image|
f.puts “\t[exec] (#{image[0..-5].gsub(”-“,” “).gsub(”_“, ” “).capitalize}) {Esetroot -c #{ENV[’HOME’]}/.fluxbox/backgrounds/#{image}}”
end
f.puts “[end]”
end
end
end
print Menu::new


I know, you’re thinking “What the hell does this do?” Here’s what it does. In fluxbox there is a file called menu. It’s read every time you right click the background. You can include other files. So if you include “imagemenu” then you can use this program to make an easy menu for setting your background.

Here’s how it works. When you get your new account you pull up your console and type ‘makeimagemenu.rb “Whatever Your Menu Is Called”’ and then it makes the menu. Drop all the image files you want into the .fluxbox/backgrounds directory and select “update menu” and it’ll add them to the menu. Then just select the name from the menu and it sets that image as your background. Nice and simple like. Oh, and if you want to change the name of the menu just re-run it from the console.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments