wmiirc-rumai

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

commit 4e433d42a041311bece967700afd4fe9c3d7c7c7
parent 349e37f8a313bbff51d70b90a1ac165cc7390a8d
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Mon, 11 May 2009 22:08:57 -0700

add 'position' option for status buttons, which lets you
specify the order in which they appear on the status bar

Diffstat:
config.rb | 5++++-
config.yaml | 10++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/config.rb b/config.rb @@ -269,7 +269,10 @@ def load_config_file config_file @status_button_by_name = {} CONFIG['display']['status'].each do |name, defn| - button = eval "Button.new(Rumai.fs.rbar[#{name.inspect}], #{defn['refresh']}) { #{defn['content']} }", TOPLEVEL_BINDING, "#{config_file}:display:status:#{name}" + # buttons are displayed in the ASCII order of their IXP file names + file = [defn['position'], name].compact.join('-') + + button = eval "Button.new(fs.rbar[#{file.inspect}], #{defn['refresh']}) { #{defn['content']} }", TOPLEVEL_BINDING, "#{config_file}:display:status:#{name}" @status_button_by_name[name] = button end diff --git a/config.yaml b/config.yaml @@ -80,8 +80,9 @@ display: # Self-refreshing buttons on the status bar. # # <IXP node basename>: - # refresh: <number of seconds to wait before refreshing the content> - # content: <Ruby code whose result is displayed as the content> + # position: <index of this button on the status bar> # (optional) + # refresh: <number of seconds to wait before refreshing the content> + # content: <Ruby code whose result is displayed as the content> # # You can refresh a particular status button in Ruby using: # @@ -89,25 +90,30 @@ display: # status: clock: + position: 5 refresh: 5 content: Time.now.to_s cpu_load: + position: 4 refresh: 10 content: File.read('/proc/loadavg').split.first(3).unshift('load') disk_space: + position: 3 refresh: 600 # 10 minutes content: | free, used, path = `df -h ~`.split.last(3) [path, used, 'used', free, 'free'] volume: + position: 1 refresh: 60 content: | ['vol', `amixer get Master`.scan(/\d+%/).first] music: + position: 2 refresh: 15 content: | unless defined? @music