Mercurial > addons > weechat-scripts > weechat-terminal-title-script
changeset 1:98c1a683d9c1
Update the terminal title when the configuration changes
author | Guido Berhoerster <guido+weechat@berhoerster.name> |
---|---|
date | Sat, 14 Mar 2015 16:09:47 +0100 |
parents | c54a46719c46 |
children | c86ca2eea6bc |
files | terminal-title.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/terminal-title.py Tue Mar 10 22:40:28 2015 +0100 +++ b/terminal-title.py Sat Mar 14 16:09:47 2015 +0100 @@ -104,6 +104,10 @@ return weechat.WEECHAT_RC_OK +def config_hook(data, option, value): + set_term_title_hook("", "", "") + + return weechat.WEECHAT_RC_OK if __name__ == '__main__': weechat.register(SCRIPT_NAME, AUTHOR, VERSION, 'GPL3', DESCRIPTION, '', '') @@ -119,8 +123,10 @@ for term_name, term_template in TERM_TEMPLATES: if term.startswith(term_name): TERM_TEMPLATE = term_template - for hook in ["buffer_switch", "buffer_title_changed", - "hotlist_changed", "upgrade_ended"]: - weechat.hook_signal(hook, "set_term_title_hook", "") - set_term_title_hook("", "", "") + for hook in ['buffer_switch', 'buffer_title_changed', + 'hotlist_changed', 'upgrade_ended']: + weechat.hook_signal(hook, 'set_term_title_hook', '') + weechat.hook_config('plugins.var.python.%s.*' % SCRIPT_NAME, + 'config_hook', '') + set_term_title_hook('', '', '') break