Warning: Declaration of action_plugin_indexmenu::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/lib/plugins/indexmenu/action.php on line 18 Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/lib/plugins/indexmenu/action.php:0) in /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/inc/auth.php on line 495 Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/lib/plugins/indexmenu/action.php:0) in /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/inc/actions.php on line 687 Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/lib/plugins/indexmenu/action.php:0) in /home/httpd/vhosts/scratchbook.ch/wiki.scratchbook.ch/inc/actions.php on line 687 thinklight-blink-on-hexchat-irc-message

Lets your thinklight blink if you receive a private channel message in the hexchat IRC client.

NOTE:

→ Put the following line in /etc/init.d/rc.local:

chmod a+w /sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness

Save script as ~/.config/hexchat/addons/thinkblink.py to make it auto-loaded.

Thinklight documentation at http://www.thinkwiki.org/wiki/ThinkLight

#!/usr/bin/python

# assure mode 666 on /sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness before use.

import hexchat
#from __future__ import braces
from time import sleep
import threading

__module_name__ = "thinkblink"
__module_version__ = "1.0"
__module_description__ = "Thinklight blink on privmsg"


def beep_cb(word, word_eol, userdata):
        # word[2] is the privmsg target (nick or #channel)
        if word[2] != 'NICK':
                return hexchat.EAT_NONE
        t1 = threading.Thread(target=beep_thread)
        t1.start()
        return hexchat.EAT_NONE

def beep_thread():
        try:
                f = open('/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness', 'w')
        except IOError:
                # file mode not set
                return
        for x in range(0,3):
                f.write('255')
                f.flush()
                sleep(0.25)
                f.write('0')
                f.flush()
                sleep(0.25)
        f.close()

hexchat.hook_server("PRIVMSG", beep_cb)