Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.
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>
_
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:
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
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)...
Mac support
eta > 8 months
Timothy Eichler, Original Author of the system_hotkey package Henri Hänninen
FAQs
System wide hotkeys
We found that system-hotkey310 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.