Skip to content

Support back mouse button #6996

Closed
Closed

Description

@Pablohn26
  • Electron version:1.3.1
  • Operating system:Fedora 24

It seems Event: ‘app-command’ is only available in Windows. Would be possible to add Linux support of it?

Activity

  1. added
    blocked/need-info ❌
    on Aug 29, 2016
  2. zcbenz commented on Aug 29, 2016

    @zcbenz
    Contributor

    There is no app-command on Linux, the buttons on mouses are translated to key events depending on your machine's configuration. Can you try whether the button works in Chrome browser? And if it is working can you use the xev tool to get what key event the button is translated to?

  3. MarshallOfSound commented on Aug 29, 2016

    @MarshallOfSound
    Member

    GPMDP uses a native node module for forward and back mouse buttons on linux that we made ourselves.

    https://github.com/jostrander/mouse-forward-back

    Does this fulfill your needs?

  4. Pablohn26 commented on Aug 29, 2016

    @Pablohn26
    Author

    I have run xev -event button with next output

    root:1@/tmp# xev -event button
    Outer window is 0x6c00001, inner window is 0x6c00002
    
    ButtonPress event, serial 25, synthetic NO, window 0x6c00001,
        root 0xd4, subw 0x6c00002, time 75696468, (46,32), root:(143,592),
        state 0x10, button 9, same_screen YES
    
    ButtonRelease event, serial 25, synthetic NO, window 0x6c00001,
        root 0xd4, subw 0x6c00002, time 75696756, (46,32), root:(143,592),
        state 0x10, button 9, same_screen YES
    
    ButtonPress event, serial 25, synthetic NO, window 0x6c00001,
        root 0xd4, subw 0x6c00002, time 75697284, (46,32), root:(143,592),
        state 0x10, button 8, same_screen YES
    
    ButtonRelease event, serial 25, synthetic NO, window 0x6c00001,
        root 0xd4, subw 0x6c00002, time 75697556, (46,32), root:(143,592),
        state 0x10, button 8, same_screen YES
    

    button 9 is forward button and button 8 is back button.

    And yes, it is working on Google Chrome and chromium.

  5. removed
    blocked/need-info ❌
    on Aug 30, 2016
  6. changed the title [-]Request: back mouse button in Linux [/-] [+]Support back mouse button[/+] on Feb 7, 2017
  7. jonathansampson commented on Apr 2, 2017

    @jonathansampson

    I came to the same results as @Pablohn26.

    brave/browser-laptop#5620 (comment)

  8. jaewonha commented on Mar 15, 2018

    @jaewonha

    came here from vs code not supporting back key navigation...
    please someone take care of this issue...!

  9. verner-lall commented on Apr 25, 2018

    @verner-lall

    Almost 2 years for something seemingly simple. Please?

  10. SocksPls commented on Apr 25, 2018

    @SocksPls

    Anything? This is the only thing stopping me using brave as my main browser on all of my computers.

  11. premek commented on Apr 25, 2018

    @premek

    How should this be implemented?

    • Should it emulate app-command windows event on linux? (no need to change the apps and it will start automatically working)
    • use a different api for listening to mouse buttons? Apps would have to implement it differently on win/linux
    • use mouse-forward-back package as suggested above? That would also have to be implemented in apps differently for linux

    Also, how about OSX?

  12. Aetherall commented on Jul 29, 2018

    @Aetherall

    I am not an electron developer so maybe I am saying pure nonsense :)

    but maybe it is solvable by the adapter paradigm,
    where there is an "OSX mouse event adapter", "Linux mouse event adapter" and "Windows mouse event adapter" and the correct one is chosen on compile time?

  13. coreybruce commented on Sep 11, 2018

    @coreybruce

    it already is supported in Linux and it's really annoying, I keep accidentally pressing the button on my mouse, how do I disable the back button?!

  14. 1 remaining item

  15. coreybruce commented on Sep 24, 2018

    @coreybruce

    If you guys want to disable the back button from working on your web page in electron just use this script in the body

    onLoad="noBack();" onpageshow="if (event.persisted) noBack();"

    e.g

    <body onLoad="noBack();" onpageshow="if (event.persisted) noBack();" onUnload="" style="margin: 0 auto;">
    </body>
    
  16. jonathansampson commented on Sep 30, 2018

    @jonathansampson

    @coreybruce Your code lacks the function itself. Is noBack already defined as a global somewhere in Electron? Also, why would you want to do this?

  17. coreybruce commented on Oct 1, 2018

    @coreybruce

    @coreybruce Your code lacks the function itself. Is noBack already defined as a global somewhere in Electron? Also, why would you want to do this?

    I have a gaming application called Gamer World and I it is really annoying when I accidentally press the back button my mouse in the middle of a game and it goes back a page.

    here is a link to the Gitlab repo

    https://gitlab.com/coreybruce/Gamerworld-App

  18. britalmeida commented on Oct 7, 2018

    @britalmeida

    Can you communicate better and make it easier for software using electron to setup the navigate back/forwards correctly?
    Currently, neither VSCode or Spotify on Linux have the functionality working.

  19. JoseFMP commented on Oct 20, 2018

    @JoseFMP

    As @britalmeida mentioned. Why wouldn't this be used in VSCode on Linux? Would be great to propagate the achievement :)

  20. coreybruce commented on Oct 20, 2018

    @coreybruce

    What does VSCode have to do with Electron tho @JoseFMP?

  21. codebytere commented on Oct 20, 2018

    @codebytere
    Member

    @coreybruce: vscode is an electron app 😉

  22. coreybruce commented on Oct 21, 2018

    @coreybruce

    @codebytere Oh right I see

  23. fatmalama commented on Apr 17, 2019

    @fatmalama

    this is crazy. why is there an API difference for something so basic between windows and linux and why should each app implement back and forward specifically for linux and not share code with windows and macos?

  24. Yanpas commented on Apr 26, 2019

    @Yanpas

    Seems like mac users are still lacking this.
    https://electronjs.org/docs/api/browser-window#event-app-command-windows-linux

    Why not introduce separate event 'navigation' or 'crossplatform-command' event? This is VERY ugly workaround.

  25. luxalpa commented on Dec 8, 2019

    @luxalpa

    Isn't electron supposed to make cross platform development easier? Then why suddenly separate this behavior between platforms?

  26. RattlingAmigo commented on Oct 17, 2020

    @RattlingAmigo

    With some javascript and html, we can make like browsers button (<) (>) for every platform.
    Making below lines of the code on top of the page, with some css would be the work around.

    Code:

    <input type=button name="back" value="Go Back" onclick="history.back();">
    <input type=button name="forward" value="Go Forward"onclick="history.forward();">
    
  27. Tejeev commented on Feb 5, 2025

    @Tejeev

    Still an issue, and no, uerland does not have a fix for each electron app. Please fix this.. It's honestly kind of ridiculous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions