This project handle keyboard shortcuts for multimedia control (play/pause, previous track, next track)
For the moment, Mediakey is available for Windows and Debian based Linux distributions. The program has been tested on Windows 11 and Ubuntu 24.04.
At the root of the project you need to have a config folder containing a config.json file like this :
{
"log_path": "path/to/your/log/folder",
"next_key": "right",
"prev_key": "left",
"play_key": "down"
}
To run the program you need the following softwares :
-
On Windows :
- Python 3.10 or above
- nircmd (in your Windows directory)
-
On Linux :
- Python 3.10 or above
- playerctl
For both systems, Python required packages can be found in the requirements.txt files (Windows and Linux).
If you want the program to run at startup, execute the script installation.bat from the project root. This will create a launcher file in your startup folder and it will start the program. This will also create a virtual environment in the project root (.venv).
If you want to remove the program from the startup, execute the script uninstall.bat from the project root.
To install the program on Linux, you have to execute the installation script from the project root with superuser rights :
sudo bash installation.sh
This script will install the required packages, create a virtual environment in the project root (.venv) and create a service in systemd named mediakey. The service will start at boot. Mediakey service can then be controlled with classic systemctl commands.
If you have installed the program with the installation script, you don't need to create the virtual environment.
Otherwise, you have to create a Python virtual environment in the project root :
python -m venv .venv
Then you have to activate the virtual environment :
./.venv/Scripts/activate (Windows)
source .venv/bin/activate (Linux)
Then you have to install the required packages :
pip install -r requirements.txt
To deactivate the virtual environment :
deactivate
Altough the program can be started manually, it is recommended to use the installation script to start the program at startup.
To simply run the program on Windows, execute the script launch.bat from the project root (you need to have created the virtual env).
To stop the program, execute the script stop.bat from the root project or right click on the Mediakey icon in your system tray and click on "Quit".
Once the program is running, you can control your multimedia player with the following shortcuts :
- next track : ctrl + windows + right
- previous track : ctrl + windows + left
- play/pause : ctrl + windows + down
The arrow keys can be changed in the config/config.json file.
The program is meant to be run as a service on Linux. To do so, refer to the installation part.
The launch and stop scripts are currently deprecated and will be adapted in the future. If you want to force the execution of the program, you can execute the following command :
python src/mediakey.py --force