Jessica Fae (jessica_fae) wrote,
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}}”
f.puts “[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.

  • كلمة اليوم

    كلمة اليوم هي الفسوق! Today's word of the day comes to you in honor of being in Vegas! Though, apparently something (probably this app) deleted…

  • اختبار

    هذا هو اختبار

  • Trying to not be confused.

    So, I am sitting here watching some anime, and it has the usual problems that I run into with anime. Firstly, it is very childish in many ways. It…

  • Post a new comment


    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.