pockestrap

Programmer's memo

TweetVim で mikutter の様にふぁぼ通知を鳴らす

hookがあるのでそれを使ってやれば実現できます。

TweetVimのドキュメントを見てみると、このように記述があります。

HOOKS                     *tweetvim-hooks*

You can use hooks by tweetvim#hook#add(name, func_name).

notify_fav
        favorite event in userstraem

write_screen_name

        write screen name to cache file

write_hash_tag
        write hash tag to cache file
------------------------------------------------------------------------------
WORK IN PROGRESS

notify_unfav
        unfavorite event in userstraem

notify_retweet
        retweet event in userstraem

notify_mention
        mentions event in userstream

https://github.com/basyura/TweetVim/blob/d63331ef51f70fd5fcd308a16cf3d65f250d6bb3/doc/tweetvim.txt#L372-L396

ふぁぼのhookは実装されているようなので、これを使用します。

function! SayFav(...)
  call vimproc#system_bg('aplay /opt/mikutter/core/skin/data/sounds/favo.wav')
endfunction
call tweetvim#hook#add('notify_fav', 'SayFav')

こんな感じ。 notify-sendを使ってポップアップも出したかったけど、hookの関数にツイートの情報が渡ってこない(?)みたいなのでとりあえず諦めた。

メンションやリツイートの通知も鳴らしたいなぁ。


2014/08/03追記

notify_retweetは実装されているみたい?試したら通知が鳴った。