LoginSignup
9
10

More than 5 years have passed since last update.

Ubuntu+WeechatでもIRCで呼ばれたら通知したい!

Posted at

MacだとGrowl使えたけどUbuntuで似たことやるにはどうすんだろと思って調べた.

notify-send というのがある. これを使えば任意のテキストをGrowlっぽく通知させることができる.

$ gem install weechat

以下のような内容を ~/wee.rb として保存.

~/wee.rb
# coding: utf-8
require 'rubygems'
require 'weechat'

def weechat_init
  Weechat.register("send-notify", "memerelics", "0.1", "GPL3",
                   "Notify message with using notify-send.", "", "")
  run_hook_signal
  return Weechat::WEECHAT_RC_OK
end

def run_hook_signal
  Weechat.hook_signal("weechat_highlight", "notify_highlight", "")
end

def notify_highlight(data, signal, message)
  notify message
end

def notify message
  system("/usr/bin/notify-send", message)
end

weechatコマンドで以下のようにこのスクリプトをload.

/ruby load ~/wee.rb

これであとは自分の名前が出たらポップアップが出てきます.

あずにゃんに怒ってもらうことができました.

9
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
10