Guest User

Untitled

a guest
Mar 22nd, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import xchat
  2.  
  3. __module_name__ = "ac100 flashlight"
  4. __module_version__ = "1.0"
  5. __module_description__ = ""
  6.  
  7. fl_contexts = []
  8.  
  9. def set_flashlight(hl_type=1):
  10. sys_fs = open('/sys/class/leds/nvec-led/brightness','w')
  11. sys_fs.write(str(hl_type))
  12. sys_fs.close()
  13.  
  14. def fl_hook(word, word_eol, userdata):
  15. if xchat.get_info('win_status') == 'active':
  16. return xchat.EAT_NONE
  17. set_flashlight(1)
  18. global fl_contexts
  19. context = xchat.get_context()
  20. if context not in fl_contexts:
  21. fl_contexts.append(xchat.get_context())
  22. return xchat.EAT_NONE
  23.  
  24. def focus_hook(word, word_eol, userdata):
  25. context = xchat.get_context()
  26. global fl_contexts
  27. if context in fl_contexts:
  28. fl_contexts.remove(context)
  29. if not len(fl_contexts):
  30. set_flashlight(0)
  31. return xchat.EAT_NONE
  32.  
  33. xchat.hook_print("Focus Tab", focus_hook)
  34. xchat.hook_print("Focus Window", focus_hook)
  35. xchat.hook_print("Channel Action Hilight", fl_hook)
  36. xchat.hook_print("Channel Msg Hilight", fl_hook)
Advertisement
Add Comment
Please, Sign In to add comment