commit ec34f95871213f8b941082724c72652bfdc43849
parent 4e433d42a041311bece967700afd4fe9c3d7c7c7
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Mon, 11 May 2009 22:10:41 -0700
clear status bar before adding status buttons (idea by wabu)
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/config.rb b/config.rb
@@ -183,11 +183,9 @@ class Button < Thread
def initialize fs_bar_node, refresh_rate, &button_label
raise ArgumentError, 'block must be given' unless block_given?
- super(fs_bar_node) do |b|
- b.create unless b.exist?
-
+ super(fs_bar_node) do |button|
while true
- data =
+ label =
begin
Array(button_label.call)
rescue Exception => e
@@ -196,11 +194,12 @@ class Button < Thread
end
# provide default color
- unless data.first =~ /(?:#[[:xdigit:]]{6} ?){3}/
- data.unshift CONFIG['display']['color']['normal']
+ unless label.first =~ /(?:#[[:xdigit:]]{6} ?){3}/
+ label.unshift CONFIG['display']['color']['normal']
end
- b.write data.join(' ')
+ button.create unless button.exist?
+ button.write label.join(' ')
sleep refresh_rate
end
end
@@ -265,6 +264,8 @@ def load_config_file config_file
# status
action 'status' do
+ fs.rbar.clear
+
unless defined? @status_button_by_name
@status_button_by_name = {}