Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Plugin
- Plugin.define "butzopower@gmail.com" do
- author '"Brian Butz" <butzopower@gmail.com>'
- bar_applet("weather", 900) do |wmii, bar|
- weather_proc = Proc.new do
- weather_array = `weather --id=#{wmii.plugin_config["butzopower@gmail.com:weather"]["id"]}`.split("\n")
- temp = weather_array[-2].match(/-*\d{1,3}\.*\d* F/).to_s.gsub(/ /, "°")
- humid = weather_array[-1].match(/\d+\.*\d*%\Z/).to_s
- temp + '(' + humid + ')'
- end
- Thread.new do
- loop do
- bar.data = weather_proc.call
- sleep 15*60
- end
- end
- fl = lambda{ wmii.write "/tag/sel/ctl", "select ~" }
- toggle_fl = lambda{ sleep 2; wmii.write "/tag/sel/ctl", "select toggle" }
- xmessagebox = "xmessage -center -buttons quit:0 -default quit -file -"
- bar.on_click(MOUSE_BUTTON_LEFT) do
- fl[]
- system "weather --id=#{wmii.plugin_config["butzopower@gmail.com:weather"]["id"]} | ssid #{xmessagebox} &"
- toggle_fl[]
- end
- end
- end
- ##wmiirc-config.rb
- plugin_config["butzopower@gmail.com:weather"]["id"] = "KIOW"
- ...
- from "butzopower@gmail.com" do
- use_bar_applet "weather", 850
- end
Add Comment
Please, Sign In to add comment