The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
ruby-wmii 0.3.0: extensibility via plugins, easier upgrades, new applets (MPD, battery monitor)...

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eigen Class

Posts: 358
Nickname: eigenclass
Registered: Oct, 2005

Eigenclass is a hardcore Ruby blog.
ruby-wmii 0.3.0: extensibility via plugins, easier upgrades, new applets (MPD, battery monitor)... Posted: Jul 4, 2006 4:30 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: ruby-wmii 0.3.0: extensibility via plugins, easier upgrades, new applets (MPD, battery monitor)...
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eigen Class
Latest Posts From Eigenclass

Advertisement

For those who like scripting their window manager, the most notable change in ruby-wmii 0.3.0 is the new configuration system which preserves your settings across upgrades and allows for extensibility via plugins. Implemented as explained in an earlier posting where I showed the basics of a plugin framework for Ruby apps, the new plugin functionality looks like this:

Usage
from "standard"  do
  use_bar_applet "volume", 999
  use_bar_applet "mode", 900
  use_bar_applet "status", 100
  #use_bar_applet "cpuinfo", 150
  use_bar_applet "mpd", 10
  #use_bar_applet "battery-monitor

  use_binding "dict-lookup", "MODKEY-x"   # override default keybinding
  use_binding "execute-program-with-tag"
  use_binding "execute-action"
  use_binding "execute-program"
  (0..9).each{|k| use_binding "numeric-jump-#{k}"  }
  #...
end

Definition

(in a separate file under the plugin directory)

Plugin.define "standard" do 
  author "Mauricio Fernandez <mfp@acm.org>"

# # {{{ CPU info applet
  bar_applet("cpuinfo", 800) do |wmii, bar|
    Thread.new do
      loop do
        cpuinfo = IO.readlines("/proc/cpuinfo")[6].split[-1].sub(/\..*$/,'')
        bar.data = cpuinfo.chomp + " Mhz"
        sleep 5
      end
    end
  end
  
# ...

  binding("dict-lookup", "MODKEY-Control-d") do |wmii,|
    LOGGER.debug "dict-lookup called!!!"
    Thread.new do
      wmii.wmiimenu([]) do |phrase|
        system "dcop kdict KDictIface definePhrase '#{phrase}'"
      end.value  # block until we get the word
      wmii.set_curr_view "dict"
    end
  end
  #...


end

Download

As usual, the latest version is available here.

Change summary


Read more...

Read: ruby-wmii 0.3.0: extensibility via plugins, easier upgrades, new applets (MPD, battery monitor)...

Topic: RubyOSA: a Ruby/AppleEvent bridge Previous Topic   Next Topic Topic: Mouse Coordinates To Lat/Long

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use