diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-02-22 10:50:16 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-02-22 10:50:16 +0000 |
commit | f5731322daedc83590769d341791e478e889cdad (patch) | |
tree | d36ab3a360d110f727905e8ac7778aa0ef8094ff | |
parent | 1dc994e5f6a4aff8bb047bc7d8c7b1f1c1eb08f0 (diff) | |
download | weechat-f5731322daedc83590769d341791e478e889cdad.zip |
Added awl.py script
-rw-r--r-- | scripts/python/awl.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/python/awl.py b/scripts/python/awl.py new file mode 100644 index 000000000..cf8bfd434 --- /dev/null +++ b/scripts/python/awl.py @@ -0,0 +1,47 @@ +""" + This script shows buffer list in infobar. Nothing more. + It's inspired by `awl.pl` irssi script, but is less advanced. :) + + The script is in the public domain. + Leonid Evdokimov (weechat at darkk dot net dot ru) + http://darkk.net.ru/weechat/awl.py +""" + +####################################################################### + +import weechat + +version = "0.1" +# how often to refresh infobar +timer_interval = 1 + +def cleanup(): + weechat.remove_infobar(-1) + return weechat.PLUGIN_RC_OK + +def update_channels(): + the_string = []; + buffers = weechat.get_buffer_info() + if buffers != None: + for index, buffer in buffers.iteritems(): + #**** info for buffer no 8 **** + # > log_filename, notify_level, server, num_displayed, type, channel + if len(buffer['channel']): + name = buffer['channel'] + elif len(buffer['server']): + name = "[" + buffer['server'] + "]" + else: + name = "?" + the_string.append("%i:%s" % (index, name)) + the_string = " ".join(the_string) + weechat.remove_infobar(-1) + weechat.print_infobar(0, the_string); + +def on_timer(): + update_channels() + return weechat.PLUGIN_RC_OK + +if weechat.register("awl", version, "cleanup", "bufferlist in infobar"): + #message handlers are called __before__ buflist is changed, so we don't use them + weechat.add_timer_handler(timer_interval, "on_timer") + update_channels() |