System Hotkey 310
=================
Multi platform system wide hotkeys for Python 3.10+
Currently no mac support but pull requests or collaboration is very welcome!
Note: currently this fork of system_hotkey exists just to fix Python 3.10 compatibility.
Installation
------------
the old
.. code-block:: bash
pip3 install system_hotkey310
should do the trick
Windows
^^^^^^^
install pywin32
Linux
^^^^^
For x11 you should use `xcffib <https://github.com/tych0/xcffib>`_ (bsd license),
If for some reason you have to use the python xlib bindings (gpl license), a few fixes need be added first. See `here <https://github.com/timeyyy/system_hotkey/issues/6#issuecomment-265410255>`_
Usage
------
**Input Keysyms**
System hotkeys uses the keysym names from xlib for everything besides modifiers.(although case insensitive)
grep for vk_codes for a list of available chars.
If you are unable to bind to a certain key please let us know.
You can bind directly to symbols such as ["',. etc
Numpad keys can be binded by prefixing with kp\_.
Supported modifiers include:
- control
- shift
- super (windows key)
- alt
InvalidKeyError will be raised if a key was not understood
.. code-block:: python
from system_hotkey import SystemHotkey
hk = SystemHotkey()
hk.register(('control', 'shift', 'h'), callback=lambda x: print("Easy!"))
A SystemRegisterError will be raised if a hotkey is already in use.
To unregister a hotkey
.. code-block:: python
hk.unregister(('control', 'shift', 'h'))
A KeyError will be raised if the combination is not already grabbed.
A UnregisterError will be raised if unregistering failed for any other reason.
If you want you can pass in a custom consumer:
.. code-block:: python
def some_func(self, event, hotkey, args):
pass
hk = SystemHotkey(consumer=some_func)
hk.register(hotkey, arg1, arg2, arg3)
So you have a master function that receives all hotkey presses and can delegate as desired.
**Note**
Modifier keys are independent of order i.e control + alt + del is the same as alt + control + del
Features
--------
- Support for up to 3 modifiers and a key
Limitations
-----------
- I have only mapped most common keys, i have not experimented with Unicode/Japanese characters etc. It's only a matter of mapping a name to the keysym on Linux and virtual key code on windows.
- binding to kp_left (key pad left) will also bind to kp_4, there is a flag (unite_kp) to toggle this behaviour but it is experimental
- Requires an xserver (x11)...
To be done
==========
Mac support
eta > 8 months
Version Release Notes
=====================
1.0.5
-----
* Python 3.10 compatibility
1.0.4
-----
* Exceptions are now run in main
1.0.3
-----
* Documented the fact that xlib shouldn't really be used
1.0.2
-----
* Fixed a linux bug where spurious events got passed through
1.0.0
-----
* calls to the unregister and register are now thread safe
* kp keys work properly
* kp_unite option
0.1.4
-----
* Bug fix on linux where pressing numlock would crash us..
0.1.3
-----
* Custom args can now be passed to a custom consumer
Authors and Contributors
========================
Timothy Eichler, Original Author of the system_hotkey package
Henri Hänninen
Raw data
{
"_id": null,
"home_page": "https://github.com/hhannine/system_hotkey310",
"name": "system-hotkey310",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "hotkeys python3 shortcutkeys shortuct x11 windows",
"author": "Henri H\u00e4nninen",
"author_email": "henri.j.hanninen@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ee/6e/4c428fe0720d863c53ad13477cf1dea0d0bb9fe2775652dbd95fa9e9602b/system_hotkey310-1.0.5.tar.gz",
"platform": null,
"description": "System Hotkey 310\n=================\n\nMulti platform system wide hotkeys for Python 3.10+\n\nCurrently no mac support but pull requests or collaboration is very welcome!\n\nNote: currently this fork of system_hotkey exists just to fix Python 3.10 compatibility.\n\n\nInstallation\n------------\n\nthe old\n\n.. code-block:: bash\n\n pip3 install system_hotkey310\n\nshould do the trick\n\nWindows\n^^^^^^^\ninstall pywin32\n\nLinux\n^^^^^\nFor x11 you should use `xcffib <https://github.com/tych0/xcffib>`_ (bsd license),\n\nIf for some reason you have to use the python xlib bindings (gpl license), a few fixes need be added first. See `here <https://github.com/timeyyy/system_hotkey/issues/6#issuecomment-265410255>`_\n\n\nUsage\n------\n\n**Input Keysyms**\n\nSystem hotkeys uses the keysym names from xlib for everything besides modifiers.(although case insensitive)\ngrep for vk_codes for a list of available chars.\nIf you are unable to bind to a certain key please let us know.\n\nYou can bind directly to symbols such as [\"',. etc\nNumpad keys can be binded by prefixing with kp\\_.\n\nSupported modifiers include:\n\n- control\n- shift\n- super (windows key)\n- alt\n\nInvalidKeyError will be raised if a key was not understood\n\n.. code-block:: python\n\n from system_hotkey import SystemHotkey\n hk = SystemHotkey()\n hk.register(('control', 'shift', 'h'), callback=lambda x: print(\"Easy!\"))\n\nA SystemRegisterError will be raised if a hotkey is already in use.\n\nTo unregister a hotkey\n\n.. code-block:: python\n\n hk.unregister(('control', 'shift', 'h'))\n\nA KeyError will be raised if the combination is not already grabbed.\n\nA UnregisterError will be raised if unregistering failed for any other reason.\n\nIf you want you can pass in a custom consumer:\n\n.. code-block:: python\n\n def some_func(self, event, hotkey, args):\n pass\n\n hk = SystemHotkey(consumer=some_func)\n hk.register(hotkey, arg1, arg2, arg3)\n\nSo you have a master function that receives all hotkey presses and can delegate as desired.\n\n**Note**\nModifier keys are independent of order i.e control + alt + del is the same as alt + control + del\n\nFeatures\n--------\n- Support for up to 3 modifiers and a key\n\nLimitations\n-----------\n- I have only mapped most common keys, i have not experimented with Unicode/Japanese characters etc. It's only a matter of mapping a name to the keysym on Linux and virtual key code on windows.\n\n- binding to kp_left (key pad left) will also bind to kp_4, there is a flag (unite_kp) to toggle this behaviour but it is experimental\n\n- Requires an xserver (x11)...\n\n\n\nTo be done\n==========\n\nMac support\n\neta > 8 months\n\n\nVersion Release Notes\n=====================\n1.0.5\n-----\n* Python 3.10 compatibility\n\n1.0.4\n-----\n* Exceptions are now run in main\n\n1.0.3\n-----\n* Documented the fact that xlib shouldn't really be used\n\n1.0.2\n-----\n* Fixed a linux bug where spurious events got passed through\n\n1.0.0\n-----\n* calls to the unregister and register are now thread safe\n* kp keys work properly\n* kp_unite option\n\n0.1.4\n-----\n* Bug fix on linux where pressing numlock would crash us..\n\n0.1.3\n-----\n\n* Custom args can now be passed to a custom consumer\n\n\n\n\nAuthors and Contributors\n========================\n\nTimothy Eichler, Original Author of the system_hotkey package\nHenri H\u00e4nninen\n",
"bugtrack_url": null,
"license": "BSD3",
"summary": "System wide hotkeys",
"version": "1.0.5",
"split_keywords": [
"hotkeys",
"python3",
"shortcutkeys",
"shortuct",
"x11",
"windows"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "fb2875e55b83e180fa1cc806b77c7eb4",
"sha256": "b4fd85d9ea5cac7d949421b945e718b80997eb08578627c809eef9adc219c0c7"
},
"downloads": -1,
"filename": "system_hotkey310-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb2875e55b83e180fa1cc806b77c7eb4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 31267,
"upload_time": "2022-12-10T21:28:07",
"upload_time_iso_8601": "2022-12-10T21:28:07.392838Z",
"url": "https://files.pythonhosted.org/packages/9e/77/f0190b70abf886a328ea318e13bb571ffff880a60ad299cdc0c9dca84348/system_hotkey310-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "77e789b0ce74e380e99f96190282a483",
"sha256": "84d160a678e5afae53bca59f647433e9aefb402f80302f5f8e1479231227abab"
},
"downloads": -1,
"filename": "system_hotkey310-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "77e789b0ce74e380e99f96190282a483",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32071,
"upload_time": "2022-12-10T21:28:10",
"upload_time_iso_8601": "2022-12-10T21:28:10.043588Z",
"url": "https://files.pythonhosted.org/packages/ee/6e/4c428fe0720d863c53ad13477cf1dea0d0bb9fe2775652dbd95fa9e9602b/system_hotkey310-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-10 21:28:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hhannine",
"github_project": "system_hotkey310",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "system-hotkey310"
}