Shortcut keyboard

I have two keyboards attached to my computer now, one for the sole purpose of launching other
programs when specific keys are struck.

This is input device portion of my xorg.conf file. It is set up so my input device is that of my main keyboard. This means any other keyboards attached to the PC don’t produce characters when their keys are struck.

Section “InputDevice”
Identifier “Keyboard0”
Driver “evdev”
Option “Device” “/dev/input/event4”
EndSection

To catch the key presses and run specific programs upon specific key codes I used:
http://www.bedroomlan.org/~alexios/coding_evrouter.html

Below is the config file I use which means when the ‘f’ key is pressed firefox is launched.

~/.evrouterrc:

Window “”: # Window title
“Keyboard” “” any key/33 “Shell/firefox”

Run using:
./evrouter /dev/input/event2

(n.b. you will have to run as root unless /dev/input… is user accessible, this is obviously a bad idea, as it means any program run from it will also be root. An entry in /etc/udev/rules.d/ can be added so your user can read the device, remember this does make it easier for keyloggers to gain access to your keystrokes)

Facebook status notifier

Simple python script which notifies you when a status for a particular person has changed.
It requires the pynotify library along with the Facebook python API.

#!/usr/bin/python

import pynotify
import time 




def desktop_app():
    from facebook import Facebook


    pynotify.init("Facebook_status")

    # need to obtain two md5sums from your own app you create with facebook
    facebook = Facebook("md5","md5")

    facebook.auth.createToken()
    # Show login window
    facebook.login()

    # Login to the window, then press enter
    print 'After logging in, press enter...'
    raw_input()

    facebook.auth.getSession()
        
    dict = {}
    
    while True:
        friends = facebook.friends.get()
        friends = facebook.users.getInfo(friends, ['name', 'status'])

        for friend in friends:
            name=friend['name']
            status=""
            newMsg = False
            
            if 'message' in friend['status']:
                status=friend['status'][unicode("message")]                    
                if dict.has_key(name):
                    if dict.get(name) != status:
                        dict[name]=status
                        newMsg=True
                else:
                    dict[name]=status
                    newMsg = True

                    
                if status != u'' and newMsg == True:
                    n = pynotify.Notification("Facebook", name+" " +status, "gtk.STOCK_INFO")
                    n.set_urgency(pynotify.URGENCY_NORMAL)
                    n.set_timeout(12000)
                    n.show()         
                    

        time.sleep(60)
        print "looped"
    
desktop_app()