Extra mouse button support
Opened this issue · 6 comments
Hello everyone.
I have Logitech mouse, which has extra buttons, and I wish to use it as bindings for media widget.
I have to add this lines into function _mouseActionButton:
} else if (button === 8) {
this._mouseAction(mouseActionTypes.EXTRA1_CLICK);
} else if (button === 9) {
this._mouseAction(mouseActionTypes.EXTRA2_CLICK);
}
also redefine mouseActionTypes enum:
let mouseActionTypes = {
LEFT_CLICK: 0,
RIGHT_CLICK: 1,
MIDDLE_CLICK: 2,
LEFT_DBL_CLICK: 3,
RIGHT_DBL_CLICK: 4,
SCROLL_UP: 5,
SCROLL_DOWN: 6,
HOVER: 7,
EXTRA1_CLICK: 8,
EXTRA2_CLICK: 9,
};
and finally, in prefs.js add support to configure it:
const mouseActionLabels = [
_("Left click"),
_("Right click"),
_("Middle click"),
_("Left double click"),
_("Right double click"),
_("Scroll up"),
_("Scroll down"),
_("Hover"),
_("Button 8 click"),
_("Button 9 click"),
];
Everything is working now and I can set actions for extra mouse buttions.
Should be great if it will be in upstream some day, but have no idea, is it always Button8 and Button9, or maybe Button6/7 on some mouses, etc.
I don't have any issue with adding support for additional mouse buttons. If you can create a pull request with the above changes, that would be helpful.
There are two problems with that:
- I have no idea which files I have to change in original source code, because I'm on Debian Stable with GNOME 43, and master branch written in TypeScript with no mentions of mouseActionTypes or mouseActionLabels
- I have no idea are the extra mouse buttons always BUTTON8 and BUTTON9 as on my Logitech Master and not, for example, BUTTON6 and BUTTON7.
We do not maintain the version below GNOME 45 any more. The code changed significantly with GNOME 45 and then the extension was rewritten in typescript.
It is not really much work to add this IMHO but where to stop ?
My mouse has 5 buttons. The requesters has 9.
Currenty we support 3 buttons - left middle and right. In my opinion its enough.
There will be for sure somebody who has 11 buttons or more.
Not really a often requested feature.
@sakithb What do you think - add button 4-9 or leave it alone ?
@ChrisLauinger77 not so - my mouse has two extra buttons, but its codes are 0x08 and 0x09.
My mouse is Logitech MX Master.
What I tried to say that I am not sure that every mouse with two extra buttons has the 0x08 and 0x09 codes and not, for example, 0x06 and 0x07.
For me personally the two extra buttons was the one feature which I was missing because there was nowhere to bind "Next" and "Prev".
It could be solved by "double left" and "double right" clicks but that's not cool :)
By the way, I can't contribute to new version because I'm user of Debian Stable and can not into new GNOME :)
@snoopcatt You will get newer GNOME when debian stable updates next year.
Until then you have your solution - we will not update the old version of the extension as said before.
In the new code we would need the Clutter button representation
https://github.com/sakithb/media-controls/blob/eeb83ab018924850d22a444de6b457f119a075e4/src/helpers/shell/PanelButton.ts#L890C1-L900C18