HyprLogi is a Python-based utility that connects Hyprland's event system with Logitech devices supporting haptic feedback (like the MX Master series) via logid. It allows you to trigger configurable haptic effects on your mouse for various window manager events, such as changing workspaces, opening applications, or switching focus.
This provides a more tactile and immersive desktop experience, giving you physical confirmation for your actions.
- Event-Driven Haptics: Trigger haptic feedback on any Hyprland event.
- Highly Configurable: Easily map different events to over a dozen haptic effects using a simple JSON configuration file.
- Lightweight: Runs as a small, efficient background script.
- Debug Mode: Includes a verbose mode for easy troubleshooting and event discovery.
Before you begin, ensure you have the following installed and configured:
- Hyprland: A running and configured Hyprland Wayland compositor.
- Python: Python 3.10+ is recommended.
- LogiOps with Haptic Feedback: A specific fork of
logidthat supports haptic feedback.- You can find it here: kris7t/logiops (haptic-feedback branch)
- Python
dbus-nextlibrary: To communicate withlogid. socat(Optional but Recommended): A powerful utility for discovering Hyprland event names.
-
Clone the Repository
git clone https://github.com/mfabijanic/hyprlogi.git cd hyprlogi -
Install
logidwith Haptic Support If you haven't already, you need to build and install the specifichaptic-feedbackfork oflogid.# Clone the repository git clone https://github.com/kris7t/logiops.git cd logiops git checkout haptic-feedback # Build and install mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make sudo make install # Copy the default configuration sudo cp ../logid.cfg /etc/
Ensure the
logidservice is running:sudo systemctl enable --now logid. -
Configure D-Bus Copy the D-Bus policy file to allow system-wide communication with
logid.# From the hyprlogi project directory sudo cp pizza.pixl.LogiOps.conf /etc/dbus-1/system.d/ -
Install Python Dependencies It's recommended to use a virtual environment.
python3 -m venv .venv source .venv/bin/activate pip install dbus-next
HyprLogi uses a profile-based system, with configurations stored in the XDG standard directory (~/.config/hyprlogi).
~/.config/hyprlogi/settings.json: A simple file that points to the currently active profile.~/.config/hyprlogi/profiles/: A directory containing all your haptic profiles.
The first time you run the script, it will automatically create this structure and copy some default profiles (default.json, subtle.json, etc.) into the profiles directory.
You can switch profiles in two ways:
-
Edit
settings.json(Permanent) Change theactive_profilevalue to the filename of the profile you want to use.{ "active_profile": "subtle.json" } -
Use the
--profileCLI flag (Temporary) This is useful for testing a profile without changing your default setting.python3 hyprlogi.py --profile subtle # You can omit the .json extension
- Copy an existing profile in
~/.config/hyprlogi/profiles/, for example:cp ~/.config/hyprlogi/profiles/default.json ~/.config/hyprlogi/profiles/my-custom.json
- Edit
my-custom.jsonto your liking. The format maps Hyprland event names to haptic effect IDs.{ "default_effect": null, "events": { "activewindowv2": 2, "workspace": 5, "openwindow": 10, "closewindow": 11, "fullscreen": 7, "openlayer": { // Example for event with specific arguments "default": 1, // Default effect for any 'openlayer' event "args": { // Specific effects for certain arguments "swaync-notification-window": 15 // Effect for 'openlayer>>swaync-notification-window' } } } }default_effect: (Optional) The effect ID for any unlisted event.nulldisables it.events: A dictionary where the key is the Hyprland event name.- The value can be a direct haptic effect ID (an integer).
- Or, for more granular control, the value can be an object with:
"default": (Optional) The effect ID to use for this event if no specific argument matches."args": A dictionary mapping specific event arguments (e.g.,"swaync-notification-window") to their respective haptic effect IDs.
To find the names of events you want to use, you can listen to the Hyprland socket directly using socat.
- Open a terminal and run:
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock
- Perform actions in Hyprland (change windows, open apps, etc.). The terminal will print the event names. The event name is the string before the
>>.workspace>>1 activewindowv2>>5c2d140 openwindow>>5c2d140,1,kitty, - Add these event names to your
config.json.
To run the script, simply execute the Python file from within the project directory (and the virtual environment).
# Activate the virtual environment if you haven't already
source .venv/bin/activate
# Run the script
python3 hyprlogi.pyFor troubleshooting and seeing events in real-time, use the --debug flag:
python3 hyprlogi.py --debugFor robust, automatic startup, running HyprLogi as a systemd user service is the recommended method. This ensures it starts with your graphical session and restarts automatically if it ever crashes.
-
Create the service file directory if it doesn't exist:
mkdir -p ~/.config/systemd/user/ -
Create a new service file:
~/.config/systemd/user/hyprlogi.service -
Paste the following content into the file. You must replace
/path/to/hyprlogiwith the absolute path to this project's directory.[Unit] Description=Hyprland Haptic Feedback Service After=graphical-session.target hyprland-session.target PartOf=graphical-session.target [Service] # IMPORTANT: Replace with the absolute path to your project directory WorkingDirectory=/path/to/hyprlogi # Use the wrapper script to handle virtual environment or uv execution ExecStart=/path/to/hyprlogi/hyprlogi.sh Restart=on-failure RestartSec=5 [Install] WantedBy=graphical-session.target
-
Enable and start the service:
systemctl --user daemon-reload systemctl --user enable --now hyprlogi.service -
You can check the status and logs of the service at any time with:
systemctl --user status hyprlogi.service journalctl --user -u hyprlogi.service -f
- vjeko2404: For LogiOps Logitech MX4 Master configuration ([LogiOps Logitech MX4 Master configuration])(PixlOne/logiops#520)
- Kristóf Marussy: For the invaluable
logidfork with haptic feedback support (kris7t/logiops). - davifochi: For (davifochi/logiops).
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
