Compare commits

...

2 commits

Author SHA1 Message Date
Yash Karandikar 694b8f49f9 Add README 2022-05-11 12:22:55 -05:00
Yash Karandikar ff60d6b798 Write weechat script 2022-05-11 12:16:57 -05:00
2 changed files with 29 additions and 0 deletions

11
README.md Normal file
View file

@ -0,0 +1,11 @@
# weechat-notify
tiny notification script for weechat.
i wrote this because all of the other notification scripts i could find didn't do something i wanted or were broken in another way.
requires: rust, notify-send, python
to build, first run `cargo build --release` then move `plugin.py` and the generated .so (`target/release/libwn_backend.so`) to your python script directory (probably `~/.local/share/weechat/python` but could also be `~/.weechat/python`). then rename the .so to `libwn_backend.so`
next, run `/script load weechat-notify.py` and enjoy your notifications!

18
plugin.py Normal file
View file

@ -0,0 +1,18 @@
import weechat
import wn_backend
weechat.register("weechat-notify", "Yash Karandikar", "22.05.11", "Unlicense", "Notification script for weechat", "", "")
def notify(data, signal, signal_data):
arr = signal_data.split("\t")
nick = arr[0]
try:
text = arr[1]
except IndexError:
text = "new private message"
wn_backend.send_notification("/usr/share/icons/Papirus-Dark/128x128/apps/weechat.svg", nick, text)
return weechat.WEECHAT_RC_OK
weechat.hook_signal('weechat_highlight', 'notify', '')
weechat.hook_signal('irc_pv', 'notify', '')