pygs provides cross-platform global hotkey / shortcuts for python using PyQt.
My aim is to provide cross-platform support for global hotkeys (shortcuts) in python. Ideally I would like to remove the PyQt and libqxt dependency but that remains a (distant) future goal. I believe it is definitely possible and potentially quite useful though.
This fork support PyQt4 / PyQt5 on Python 2.x / 3.x.
Minimal for working:
For building from source:
None of them could be installed automatic, please download and install them manually.
If you install them from a package manager, please also install development packages (if exist).
Install from Source Code
$ pip install PyGlobalShortcut
$ setup.py install
(Target Qt version can be specified by environment variable
valid values are
Install from Binary Package
WARNING: Binary package probably only work with corresponding PyQt binary package.
Binary package can be found at release page, please download an unzip it.
The file name of binary packages contains name of corresponding PyQt binary package (behind '
-for-'), if that package does not exist or your PyQt is not installed from official binary package, please install pygs from source code.
There is a Wheel in it, install it by:
$ pip install <filepath.whl>
Again, binary package probably only work with corresponding PyQt binary package, please use it carefully.
$ python simple.py
Ctrl+Alt+S- activate shortcut
Ctrl+Alt+F- quit application
NOTE: Ctrl maps to COMMAND on macs!!!! Yeah this is crazy confusing. But it's Qt not me :)
There is a minimal test suite that check the compilation process for various environments and ensure QxtGlobalShortcut can be properly imported and used.
To run the tests, you must first install tox:
$ pip install tox
Then you can run the tests by running the following command:
To run the tests against a specific environment, use the -e option. E.g. to run tests with Python 2.7 and PyQt4, you would run:
$ tox -e py27-pyqt4
Here is the list of available test environments:
pygs - Python bindings to libqxt's QxtGlobalShortcut using SIP and PyQt. In other words, global hotkeys for PyQt.
You may use pygs under the terms of the General Public License (GPL) Version 3 or you may contact the author for permission or a commercial license. The commercial license option is specifically provided for those who are unable or unwilling to use the GPL.