wmiirc-rumai

git clone git://oldgit.suckless.org/wmiirc-rumai/
Log | Files | Refs | README | LICENSE

commit 5f6a0550d817b0744db3de231698e50fe699ccaa
parent c92585c29d0979967c1c6e14a995b720f50606f8
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Fri, 22 Sep 2006 23:58:35 -0700

[project @ f4e30e36beda92481dfb644445a9246c162b6111]

[project @ 124]
reverted to Ixp::Node#method_missing behavior of dereferencing sub-nodes if they are files. however, Ixp::Node#[] does not dereference unless specified.

Diffstat:
fs.rb | 13+++++++------
rc.rb | 12++++++------
wm.rb | 2+-
wmiirc-config.rb | 12++++++------
4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/fs.rb b/fs.rb @@ -111,19 +111,20 @@ module Ixp # # :call-seq: # node.child = value -> value - # node.child -> Node - # node.child! -> child.read + # node.child (tree) -> Node + # node.child (leaf) -> child.read # def method_missing aMeth, *aArgs case aMeth.to_s when /=$/ self[$`] = *aArgs - when /!$/ - self[$`, true] - else - self[aMeth] + if (n = self[aMeth]).file? + n.read + else + n + end end end end diff --git a/rc.rb b/rc.rb @@ -54,7 +54,7 @@ end # Focuses the client chosen from a menu. def focus_client_from_menu choices = Wmii.clients.map do |c| - format "%d. [%s] %s", c.index!, c.tags!, c.name!.downcase + format "%d. [%s] %s", c.index, c.tags, c.name.downcase end if target = show_menu(choices) @@ -87,7 +87,7 @@ end # Send selected clients to temporary view or switch back again. def toggle_temp_view - curTag = Wmii.current_view.name! + curTag = Wmii.current_view.name if curTag =~ /~\d+$/ Wmii.selected_clients.each do |c| @@ -114,7 +114,7 @@ end # Puts focus on an adjacent view (:left or :right). def cycle_view aTarget tags = Wmii.tags - curTag = Wmii.current_view.name! + curTag = Wmii.current_view.name curIndex = tags.index(curTag) newIndex = @@ -136,12 +136,12 @@ end # Toggles maximization of the currently focused client. def toggle_maximize src = Wmii.current_client - srcId = src.index! + srcId = src.index src.ctl = 'sendto toggle' dst = Wmii.current_view[0].sel - if dst.index! == srcId + if dst.index == srcId dst.geom = '0 0 east south' end end @@ -162,7 +162,7 @@ end def attach_last_client if a = Wmii.get_view(DETACHED_TAG).areas.last if c = a.clients.last - c.tags = Wmii.current_view.name! + c.tags = Wmii.current_view.name end end end diff --git a/wm.rb b/wm.rb @@ -381,7 +381,7 @@ module Wmii if dstIdx > maxIdx # move *near* final destination - clientId = aFirstClient.index! + clientId = aFirstClient.index aFirstClient.ctl = "sendto #{maxIdx}" # recalculate b/c sendto can be destructive diff --git a/wmiirc-config.rb b/wmiirc-config.rb @@ -280,7 +280,7 @@ SHORTCUTS = { # now, wmii reorders the remaining clients [1, 3] as: [1, 2] # that is why we must go in reverse! Wmii.selected_clients.sort_by do |c| - c.index!.to_i + c.index.to_i end.reverse.each do |c| c.ctl = 'kill' end @@ -292,7 +292,7 @@ SHORTCUTS = { # remove currently focused view from current selection's tags "#{SEND_SEQ}Shift-minus" => lambda do - curTag = Wmii.current_view.name! + curTag = Wmii.current_view.name Wmii.selected_clients.each do |c| c.untag! curTag @@ -394,7 +394,7 @@ end ('a'..'z').each do |key| SHORTCUTS["#{MENU_SEQ}v,#{key}"] = lambda do choices = Wmii.tags - choices.delete Wmii.current_view.name! + choices.delete Wmii.current_view.name if view = choices.select {|t| t =~ /^#{key}/i}.first Wmii.focus_view view @@ -413,13 +413,13 @@ Thread.new do sb = FS.bar.status sb.create! sb.colors = ENV['WMII_NORMCOLORS'] + sb.data.open do |f| loop do diskSpace = `df -h ~`.split[-3..-1].join(' ') + cpuLoad = File.read('/proc/loadavg').split[0..2].join(' ') - 10.times do - cpuLoad = File.read('/proc/loadavg').split[0..2].join(' ') - + 5.times do f.write "#{Time.now.to_s} | #{cpuLoad} | #{diskSpace}" sleep 1 end