commit 2a647da7b1bbb80fa9a176a2b56b21cefcbb259f
parent 78ad6fa66086d3d1f135c515784d53b1bc30e015
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Wed, 13 Sep 2006 19:33:21 -0700
[project @ d0df63b2606ef8ef00f8bcb10ee7a06ca3be0a2f]
[project @ 87]
add shortcut for focusing any area & Wmii#focus_area
up cheaper way to determine of cpu load
revert to wmiir for event loop, because IXP::File#read is not buffered!
rm silent retrying of IXP::Client.new
Diffstat:
4 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/HISTORY b/HISTORY
@@ -3,14 +3,16 @@ This is a history of major changes to {my wmii configuration}[http://people.ucsc
= 2006-09-13
-* Added View#diamond!, a diamond-shaped automated client arrangement.
+* Added Wmii::View#diamond! -- a diamond-shaped automated client arrangement.
-* Added Area#length= for setting number of clients in a column.
+* Added Wmii::Area#length= for setting number of clients in a column.
+
+* Reverted to *wmiir* for event loop, because Ixp#read isn't internally buffered!
= 2006-09-12
-* Event loop now uses Ixp#read instead of wmiir.
+* Event loop now uses Ixp#read instead of *wmiir*.
* Already running configurations now correctly exit when another instance starts up.
diff --git a/fs.rb b/fs.rb
@@ -23,11 +23,7 @@ require 'ixp'
# Encapsulates access to the IXP file system.
module Ixp
- begin
- @@ixp = IXP::Client.new
- rescue Errno::ECONNREFUSED
- retry
- end
+ @@ixp = IXP::Client.new
# Creates a file at the given path.
def self.create aPath
diff --git a/wm.rb b/wm.rb
@@ -98,6 +98,11 @@ module Wmii
View.new("/#{aName}").focus!
end
+ # Focuses the area with the given ID in the current view.
+ def Wmii.focus_area aAreaId
+ Wmii.current_view[aAreaId].focus!
+ end
+
# Focuses the client which has the given ID.
def Wmii.focus_client aClientId
if c = find_client(aClientId)
@@ -459,7 +464,7 @@ module Wmii
end
end
- # Arranges the clients in this view, while maintaining their relative order, in a (at best) equilateral triangle. However, the resulting arrangement appears like a diamond or rhombus because no screen space is wasted by wmii.
+ # Arranges the clients in this view, while maintaining their relative order, in a (at best) equilateral triangle. However, the resulting arrangement appears like a diamond because wmii does not waste screen space.
def diamond!
numClients = num_grounded_clients
subtriArea = numClients / 2
diff --git a/wmiirc-config.rb b/wmiirc-config.rb
@@ -27,9 +27,9 @@ FS = Wmii.fs
## WM startup
-at_exit do LOG.info($$) {"exiting"} end
+at_exit do LOG.info($$) {"exiting #{__FILE__}"} end
+LOG.info($$) {"starting #{__FILE__}"}
-LOG.info($$) {"starting"}
FS.event = "Start #{__FILE__}\n"
@@ -311,6 +311,11 @@ SHORTCUTS = {
Wmii.focus_view Wmii.tags[k] || i
end
+ # focus _i_th area
+ SHORTCUTS["#{FOCUS_SEQ}Shift-#{i}"] = lambda do
+ Wmii.focus_area i
+ end
+
# send selection to _i_th view
SHORTCUTS["#{SEND_SEQ}#{i}"] = lambda do
Wmii.selected_clients.each do |c|
@@ -372,10 +377,11 @@ Thread.new do
sb.colors = ENV['WMII_NORMCOLORS']
loop do
- cpuLoad = `uptime`.scan(/\d+\.\d+/).join(' ')
diskSpace = `df -h ~`.split[-3..-1].join(' ')
- 5.times do
+ 10.times do
+ cpuLoad = File.read('/proc/loadavg').split[0..2].join(' ')
+
sb.data = "#{Time.now.to_s} | #{cpuLoad} | #{diskSpace}"
sleep 1
end
@@ -386,18 +392,19 @@ end
## WM event loop
begin
- Ixp.open '/event' do |io|
- while event = io.read.chomp
+ # IXP::Client.new.open('/event') do |io| #io.read.chomp
+ IO.popen 'wmiir read /event' do |io|
+ while event = io.readline.chomp
type, arg = event.split($;, 2)
- case type
- when 'Start'
+ case type.to_sym
+ when :Start
if arg == __FILE__
LOG.info($$) {"another config is starting"}
exit
end
- when 'BarClick'
+ when :BarClick
clickedView, clickedButton = arg.split
case clickedButton.to_i
@@ -415,14 +422,14 @@ begin
end
end
- when 'ClientClick'
+ when :ClientClick
clickedClient, clickedButton = arg.split
if clickedButton.to_i != PRIMARY_CLICK
Wmii::Client.new("/client/#{clickedClient}").invert_selection!
end
- when 'Key'
+ when :Key
SHORTCUTS[arg].call
end
end