""" custom_beep.py - invokes a system command on highlight or private message use /set *custom_beep* to list the options to alter the custom_beep command change the option custom_beep_cmd """ import os import weechat weechat.register("custom_beep", "", "0.1", "Public domain", "Python version of Beep for weechat", "", "") settings = { 'custom_beep_highlight': 'on', 'custom_beep_pv': 'on', 'custom_beep_cmd': 'beep.sh' } for option, default in settings.items(): if weechat.config_get_plugin(option) == '': weechat.config_set_plugin(option, default) def highlight(*args): if weechat.config_get_plugin('custom_beep_highlight') == 'on': beep_cmd = weechat.config_get_plugin('custom_beep_cmd') os.system(beep_cmd) return weechat.WEECHAT_RC_OK def pv(*args): if weechat.config_get_plugin('custom_beep_pv') == 'on': beep_cmd = weechat.config_get_plugin('custom_beep_cmd') os.system(beep_cmd) return weechat.WEECHAT_RC_OK weechat.hook_signal("weechat_highlight", "highlight", "") weechat.hook_signal("weechat_pv", "pv", "")