Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra mouse button support #153

Open
snoopcatt opened this issue May 19, 2024 · 6 comments
Open

Extra mouse button support #153

snoopcatt opened this issue May 19, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@snoopcatt
Copy link

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.

@sakithb
Copy link
Owner

sakithb commented May 19, 2024

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.

@snoopcatt
Copy link
Author

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.

@ChrisLauinger77
Copy link
Collaborator

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.

@ChrisLauinger77
Copy link
Collaborator

ChrisLauinger77 commented May 20, 2024

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 ?

@snoopcatt
Copy link
Author

@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 :)
Screenshot from 2024-05-20 14-38-46

By the way, I can't contribute to new version because I'm user of Debian Stable and can not into new GNOME :)

@ChrisLauinger77
Copy link
Collaborator

ChrisLauinger77 commented May 20, 2024

@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

@ChrisLauinger77 ChrisLauinger77 added the enhancement New feature or request label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants