ubus.pl 729 Bytes
Newer Older
1 2 3
# WeeChat ubus notifications 
# Arvid Picciani <aep at hereticlinux dot org>
# Released under GPL3.
4 5
#
# 0.2 uses spec single ubus interface now.
6 7 8 9

use strict;
use FileHandle;
weechat::register("ubus", "Arvid Picciani <aep at hereticlinux dot org>", 
10 11
                  "0.2",  "GPL3", "Ubus Notification", "", "");

12 13 14 15 16 17 18 19

my @signals=qw(weechat_pv weechat_highlight);

foreach(@signals){
    weechat::hook_signal($_, "ubus_signal", "");
}

sub ubus_signal{
20 21 22 23 24 25
    my $u;
    open($u,"|ubus-connect ~/.ubus/amvient/notify >/dev/null 2>/dev/null");
    $u->autoflush(1);
    my @b = split(/\t/,$_[2]);
    print {$u} "<font color=\"red\">$_[1]</font>  &nbsp; &lt;$b[0]&gt; &nbsp; $b[1]\n";
    close $u;
26 27
    return weechat::WEECHAT_RC_OK;
}