Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import xchat
- from gi.repository import Unity, Gio, GObject, Dbusmenu
- __module_name__ = "Unity launcher count"
- __module_version__ = "1.0"
- __module_description__ = "--"
- count = {}
- launcher = Unity.LauncherEntry.get_for_desktop_id ('hexchat.desktop')
- def add_count(word, word_eol, userdata):
- key = str(xchat.get_info("network") + ":" + xchat.get_info("channel"))
- if count.get(key) == None:
- count[key] = 0
- count[key] += 1
- display_count(0,0,0)
- def clear_count(word, word_eol, userdata):
- count[str(xchat.get_info("network") + ":" + xchat.get_info("channel"))] = 0
- display_count(0,0,0)
- def clear_all_count():
- count = {}
- display_count(0,0,0)
- def display_count(word, word_eol, userdata):
- total = 0
- for key in count:
- total += count[key]
- launcher.set_property ('count', total)
- if total > 0:
- launcher.set_property ('count_visible', True)
- else:
- launcher.set_property ('count_visible', False)
- def show_count(word, word_eol, userdata):
- total = 0
- for key in count:
- total += count[key]
- print count
- print total
- xchat.hook_print("Focus Window", clear_count)
- xchat.hook_print("Focus Tab", clear_count)
- xchat.hook_server("PRIVMSG", add_count)
- xchat.hook_command("count", show_count)
- xchat.hook_command("count_clear", clear_all_count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement