python3-keybinder

Python3 Keybinding Library for X


License
CNRI-Python-GPL-Compatible
Install
pip install python3-keybinder==1.1.2

Documentation

About

python3-keybinder is python3 global keybinding library for X.

It uses python3-xlib to receive signals from X.

Related Projects

keybinder, "a library for registering global key bindings, for gtk-based applications."

Install

In Debian:

# pip3 install python3-keybinder

In Arch Linux:

# pip install python-keybinder

Usage

Some examples can be found in examples/

python3-keybinder is quite easy to use:

from gi.repository import GLib
from keybinder.keybinder_gtk import KeybinderGtk

# or use the default gtk main loop in gtk based applications.
loop = GLib.MainLoop.new(None, False)

print_key = '<Ctrl>P'
play_next_key = 'XF86AudioNext'
print_cb = lambda *args: print(key, 'was pressed')
play_next_cb = lambda *args: print('play next song')

keybinder = KeybinderGtk()
keybinder.register(print_key, print_cb)
keybinder.register(play_next_key, play_next_cb)
keybinder.start()
loop.run()

COPYRIGHT

Copyright (C) 2013 LiuLang <gsushzhsosgsu@gmail.com>

Use of this project is governed by GPLv3 license that can be found in http://www.gnu.org/licenses/gpl-3.0.html