Adding Mouse Profiles
This guide explains how to add support for new mouse models.
Overview
Mouse profiles define the buttons available on a specific mouse model, including their Qt button codes and whether they can be remapped.
Creating a Profile
1. Create JSON Definition
Create a new file in Resources/MouseDefinitions/:
{
"id": "vendor_model_name",
"name": "Vendor Model Name",
"vendor": "Vendor",
"vendorId": "0x1234",
"productIds": ["0xABCD"],
"buttons": [
{
"id": "left",
"name": "Left Click",
"qtButton": 1,
"remappable": false
},
{
"id": "right",
"name": "Right Click",
"qtButton": 2,
"remappable": false
},
{
"id": "middle",
"name": "Middle Click",
"qtButton": 4,
"remappable": true,
"defaultAction": "view_reset_3d"
},
{
"id": "back",
"name": "Back",
"qtButton": 8,
"remappable": true,
"defaultAction": "edit_undo"
},
{
"id": "forward",
"name": "Forward",
"qtButton": 16,
"remappable": true,
"defaultAction": "edit_redo"
}
],
"features": {
"horizontalScroll": false,
"thumbWheel": false
}
}
2. Add Default Preset
Create a default preset in presets/builtin/:
{
"id": "default_vendor_model",
"name": "Default (Vendor Model)",
"version": "1.0",
"mouseId": "vendor_model_name",
"mappings": {
"middle": {"action": "view_reset_3d"},
"back": {"action": "edit_undo"},
"forward": {"action": "edit_redo"}
}
}
3. Update Documentation
Add the mouse to the supported mice table in:
README.mddocs/user-guide/index.rst
Profile Fields Reference
Required Fields
Field |
Type |
Description |
|---|---|---|
|
string |
Unique identifier (lowercase, underscores) |
|
string |
Human-readable name |
|
array |
Button definitions |
Optional Fields
Field |
Type |
Description |
|---|---|---|
|
string |
Manufacturer name |
|
string |
USB vendor ID (hex) |
|
array |
USB product IDs (hex) |
|
object |
Optional hardware features |
Platform Considerations
Button codes may differ between operating systems for the same physical button.
Windows
Generally consistent with Qt standard codes
Gaming mice may use extended codes (> 32)
macOS
Requires accessibility permissions
Some buttons may be intercepted by the system
Linux
X11 and Wayland may report different codes
evdev can provide additional button information
For cross-platform profiles, test on all target platforms or document platform-specific codes.
Testing Your Profile
Load the profile: Select it from the mouse dropdown
Verify buttons appear: Check the mapping table shows all buttons
Test each button: Map each to a distinct action and verify
Test remappable flag: Ensure non-remappable buttons can’t be changed
Test default preset: Load the default preset and verify mappings
Contributing a Profile
To contribute a profile for a popular mouse:
Create the mouse definition JSON
Create a default preset
Test on your platform
Submit a pull request with:
Mouse definition file
Default preset file
Update to supported mice table
Your platform (for testing reference)
See Also
Architecture - MouseProfile class details
Preset Format - Preset format specification