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

Side mouse buttons are useless #410

Closed
BlueManCZ opened this issue Sep 23, 2017 · 17 comments
Closed

Side mouse buttons are useless #410

BlueManCZ opened this issue Sep 23, 2017 · 17 comments
Labels

Comments

@BlueManCZ
Copy link
Contributor

Hello.

I have mouse with two side buttons, which I use for "go back" and "go forward" in other browsers.
But this feature doesn't work in Min. Can I somehow get this buttons work?

jd755p_2

I'm using Debian 10 and min_1.6.2_amd64.deb package.

@PalmerAL
Copy link
Collaborator

I think this requires support in Electron: electron/electron#6996.

@SpecialBomb
Copy link
Contributor

@PalmerAL It appears to be possible. In Discord, you can register the back and forward buttons (mouse 8/9) for keybinds such as push to talk. This should therefore be very easy to implement within Min by adding code to keybindings.js or whatever. I have no idea what captures the mouse and keyboard inputs, so I wouldn't know where to start to fix it.

@PalmerAL
Copy link
Collaborator

Hmmm. The Discord app isn't open source, so we can't easily look at it to figure it out, unless we want to dig through their minified JS bundle. There's a native module to do this: https://github.com/jostrander/mouse-forward-back, but adding native modules makes it harder to build Min, so I've tried to avoid doing that. Maybe MouseEvent.button has something useful?

@BlueManCZ
Copy link
Contributor Author

BlueManCZ commented Sep 25, 2017

document.addEventListener("mousemove", function(event){
    console.log(event.buttons);
});

When I run this script in chromium-based browsers, I can see during moving 9 and 17 output for side buttons. (mousemove is bad solution) But this doesn't work in Min.

@PalmerAL
Copy link
Collaborator

@BlueManCZ Did you try moving the mouse over the webpage, or the navbar at the top? If you pasted that in the main browser console, its only going to work in the navbar; if you pasted it in the page console, its only going to work in the page.

If it works in Chromium, I would expect it to work in Min as well...

@BlueManCZ
Copy link
Contributor Author

BlueManCZ commented Apr 4, 2018

This is weird. If I paste code below to browser console, I see 8 and 16 as output. But in page console I see 9 and 17. This doesn't matter but it works. (Maybe any update fixed it). So can you bind events for "go back" and "go forward" functions on side buttons clicks?

@PalmerAL
Copy link
Collaborator

PalmerAL commented Apr 4, 2018

I guess so; which one's back and which one's forward?

It would also be know if this varies by mouse, so if anyone else has a mouse with side buttons, please try the script above as well.

@BlueManCZ
Copy link
Contributor Author

For me its 8 back and 16 forward.

But I don't know, how to get this works with mousedown event. Only left, middle and right button triggers this event for me.

@PalmerAL
Copy link
Collaborator

PalmerAL commented Apr 5, 2018

@BlueManCZ Does it work with a click event?

@BlueManCZ
Copy link
Contributor Author

@PalmerAL Seems like not. Click event works only on the navbar and only with left mouse button.

@dlovric01
Copy link

Hello, is this resolved? I am new to Min browser and am unable to use side buttons for back and forward actions on my G305. Buttons work fine in other browsers.

@BlueManCZ
Copy link
Contributor Author

Hello, is this resolved? I am new to Min browser and am unable to use side buttons for back and forward actions on my G305. Buttons work fine in other browsers.

Hello, I can confirm it's now working fine for me with my Razer DeathAdder V2.

@dlovric01
Copy link

@BlueManCZ Thank you for your response, are you by any chance using it on Mac? On windows it works fine for me but on my Macbook Air its not.

@BlueManCZ
Copy link
Contributor Author

@dlovric01 No, I tested it on Linux. I don't have a Mac to confirm it. You can try to boot a live Linux distro and test your mouse in Min there. It may be only a Mac related bug.

@PalmerAL
Copy link
Collaborator

Electron has an event for this on Windows and Linux, but it's not supported on macOS for some reason: https://www.electronjs.org/docs/latest/api/browser-window#event-app-command-windows-linux
We implement that here: https://github.com/minbrowser/min/blob/master/main/main.js#L288-L302

@dlovric01 This might be possible to implement by injecting some JS into webpages that listens for the mouse buttons (inside this code: https://github.com/minbrowser/min/blob/master/js/preload/default.js). Happy to accept a PR for this if you know of a working solution. It's going to be hard for me to do, since I don't have one of these mice.

@dlovric01
Copy link

After some debugging, I figured the problem was related to the version of Mac Mouse Fix 2 software I was using for custom commands, it seems like the default bind to back/forward button had a different command and after unbinding it, the side buttons work again as expected. It was weird because it worked normally in other browsers.
@BlueManCZ and @PalmerAL sorry for bothering and thanks for your help.

@BlueManCZ
Copy link
Contributor Author

No worries, I'm glad you found a solution. I probably can close this issue since it's been fixed for some time now and there is no real reason to keep this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants