Skip to content

Implement keyboard actions to avoid beeps on certain key bindings #2617

Closed

Description

@nathansobo

When ctrl-cmd-down, ctrl-cmd-left, or ctrl-cmd-right are pressed in any Electron (or Chrome) input or textarea, an audible beep occurs. I believe I've tracked this down to the following methods not being implemented in bridged_content_view.mm in the NSResponder Action Messages section starting at line 351.

  • - (void)makeBaseWritingDirectionNatural:(id)sender
  • - (void)makeBaseWritingDirectionRightToLeft:(id)sender
  • - (void)makeBaseWritingDirectionLeftToRight:(id)sender

They do delegate up the responder chain in their implementation of doCommandBySelector on line 579. This leaves me unsure if there's any way to implement these methods via the content API or whether we'll need to add a patch. Either way, it would be great to implement them to avoid the beeping sound when moving lines down in Atom.

Refs atom/atom atom/atom#1669

/cc @zcbenz

Activity

  1. zcbenz commented on Aug 28, 2015

    @zcbenz
    Contributor

    Awesome, I'll see if we can implement those methods in Electron, and if it doesn't work we can always patch libchromiumcontent.

  2. zcbenz commented on Sep 30, 2015

    @zcbenz
    Contributor

    Hmm I have overridden those methods in Chromium and I'm sure they are on the right place since other methods like copy: and paste: are also there, but the beep is still there.

    I also tested whether ctrl-cmd-alt-down would cause beep in Atom, and it does. The ctrl-cmd-alt-down maps to makeTextWritingDirectionNatural: and it is implemented in Chromium, so the problem is not we didn't implement the makeBaseWritingDirectionNatural: method, but something else.

    I looked into the key handling code of Chromium and tried to comment out different parts of code, however the beep is always there, I'm out of ideas now.

  3. nathansobo commented on Sep 30, 2015

    @nathansobo
    Author

    That is frustrating. Thanks for trying. I wonder if we could dtrace into the API doing the beeping and figure out what is causing it. It drives me bonkers that this key binding has such a bad experience.

  4. alexmalik commented on Jun 1, 2017

    @alexmalik

    Hello,

    I would like to open dialogue on this issue again please. I'm open to trying to fix it myself with my limited knowledge but has anyone taken this any further by any chance?

    Thanks for the efforts so far! 👍

  5. hedefalk commented on Jul 5, 2017

    @hedefalk

    @alexmalik I'm cheering you on from afar! Pretty please, I'd love a fix.

    The workaround mentioned on the atom issue here:
    atom/atom#1669 (comment)

    does not work on my 10.12.5.

  6. klvs commented on Aug 15, 2017

    @klvs

    @hedefalk That workaround didn't work for me on OSX 10.12.5 either but I did learn that you can disable those sounds globally in system prefs -> sound which is fine by me though I'm sure someone wants it.

  7. patrick-levesque commented on Aug 25, 2017

    @patrick-levesque

    It was really bugging me too and I found a fix...
    Just create a shortcut for ctrl-cmd-down in Keyboard/Shortcuts and disable it afterward.
    No more whump sound for me in Atom! 😎
    On macOS Sierra 10.12.6 with Atom 1.19.3.

    whump_fix

  8. karlhorky commented on Aug 25, 2017

    @karlhorky

    @paralel-github tried it, but didn't help. Tried restarting Atom to make sure. Sound is still there though.

  9. patrick-levesque commented on Aug 25, 2017

    @patrick-levesque

    @karlhorky You're right... when I quit Atom, it doesn't work anymore. 😳

    But I've figured out why it did work for me and here's the sequence you need to do. Will require to repeat steps each time you restart Atom. This is not the perfect fix but it works as long as you don't quit Atom.

    1. Quit Atom

    2. Open Keyboard/Shortcuts

    3. Enable the shortcut you've assigned crtl-cmd-down

    4. Quit Keyboard/Shortcuts

    5. Open Atom

    6. Open Keyboard/Shortcuts again

    7. Disable the shortcut

    8. Quit Keyboard/Shortcuts

    Then it works!

  10. karlhorky commented on Aug 25, 2017

    @karlhorky

    Heh, yep, like that it works! Good find 😄

  11. mikedpad commented on Sep 10, 2017

    @mikedpad

    @paralel-github Thanks for that temporary solution. My sanity thanks you! 😄

  12. 8 remaining items

  13. sentience commented on Jan 7, 2020

    @sentience

    Here's a work-around, which I've also posted to @hanguokai's Chromium issue (#2617 (comment)):

    You can establish system-global key bindings for the key combinations ^⌘←, ^⌘↓, and ^⌘→ that are mapped to no operation ("noop"). Simply having these declared as valid keystrokes at the OS level eliminates the system beep that occurs even when a Chromium app accepts and handles the keystroke.

    In order to establish this, you need to create a ~/Library/KeyBindings/DefaultKeyBinding.dict – note that you'll probably need to create the directory as well, and that the directory name is plural (Bindings), but the file name is singular (Binding). This should be in your user Library folder, not the /Library folder or the /System/Library folder.

    The file should be a text file with these contents:

    {
      "^@\UF701" = "noop";
      "^@\UF702" = "noop";
      "^@\UF703" = "noop";
    }
    

    ^ means Ctrl, @ means Command, and \UF701, \UF702, and \UF703 are the codes for the three arrow keys. There's a nice reference Gist for this file's syntax here: https://gist.github.com/trusktr/1e5e516df4e8032cbc3d I have attached a copy of my file in case that's easier for folks.

    DefaultKeyBinding.dict.zip

    Once you have created this file, restart any applications where you want to use these keystrokes (or just reboot your system), and you should find that the system beeps are gone. I have successfully applied this tweak on macOS Catalina (10.15.2) to use the default keyboard shortcuts for the “View: Move Editor into Next Group” and “View: Move Editor into Previous Group” commands without hearing system beeps each time.

  14. Stakker commented on Feb 5, 2020

    @Stakker

    Ahh thank you for the fix. This was driving me crazy :-)

  15. cpkenn09y commented on Aug 21, 2020

    @cpkenn09y

    same the error sounds were so annoying. Thanks for the fix @sentience!

  16. nornagon commented on Jul 12, 2022

    @nornagon
    Contributor

    fwiw if you add the Arabic input mode in Keyboard > Input Sources, then remove it, the beeps also go away.

  17. alivault commented on Jan 21, 2023

    @alivault

    I tried the fix from #2617 (comment)
    but it doesn't work on MacOS Ventura. The error sound is still there.

    Edit: I tried again and it worked. No restart needed.

  18. sentience commented on Jan 21, 2023

    @sentience

    I tried the fix from #2617 (comment)
    but it doesn't work on MacOS Ventura. The error sound is still there.

    I hadn't applied the fix on my current machine, which is running macOS Ventura 13.1. I just applied the fix it and it worked as advertised. In your position, I would double-check the spelling of all the file/directory names, and ensure that if I had downloaded the DefaultKeyBinding.dict.zip file I had extracted it to DefaultKeyBinding.dict.

    Finally, make sure restart any apps to allow the fix to take effect. In my case, I created the KeyBindings folder in /Users/kyank/Library, dropped the DefaultKeyBinding.dict.zip file into it, double-clicked it to extract the DefaultKeyBinding.dict file, and then deleted the ZIP. Once I had done that, I quit VS Code, then relaunched it after a few seconds. The beeps were gone.

  19. LeonardoRick commented on Jun 20, 2023

    @LeonardoRick

    hey @sentience I'm struggling to make the sound stop when pressing Ctrl + Option + Cmd + DownArrow

    I even tried to add on every arrow to see if this works and also change the order.

    This is my file for now:

    {
      "^@\UF701" = "noop";
      "^@\UF702" = "noop";
      "^@\UF703" = "noop";
      "^@~\UF701" = "noop";
      "^@~\UF702" = "noop";
      "^@~\UF703" = "noop";
    }
    

    Am I doing something wrong? Any advice on that? I feel that's a silly detail that is holding me back

  20. LeonardoRick commented on Jul 11, 2023

    @LeonardoRick

    Found the solution finally, just for reference, the right noop for Ctrl + Option + Cmd + DownArrow is:

    "@^~\UF701" = "noop";
    
  21. jrab commented on Feb 2, 2024

    @jrab

    @sentience thank you!! this worked perfectly (required a restart of vscode) -- was driving me up a wall

  22. didierbrouwers commented on Mar 11, 2024

    @didierbrouwers

    It looks like the custom keysBindings no longer work in macOS 14.4. When moving a line up or down with control + command + upArrow / downArrow the annoying sound effect is back again.

  23. LeonardoRick commented on Mar 11, 2024

    @LeonardoRick

    @didierbrouwers Don't know what happened with Sonoma 14.4 but I finally found a solution that is currently working for me:

    {
        "@^\UF701" = "noop:";
        "@^\UF702" = "noop:";
        "@^\UF703" = "noop:";
        "@~^\UF701" = "noop:";
    }
    

    Basically I needed to add the : at the end of noop and invert the order for the Ctrl + Option + Cmd + DownArrow

  24. didierbrouwers commented on Mar 11, 2024

    @didierbrouwers

    @LeonardoRick yes, your solution stops the sound effect again! Thanks!

  25. dannypernik commented on Jun 8, 2024

    @dannypernik

    @didierbrouwers Don't know what happened with Sonoma 14.4 but I finally found a solution that is currently working for me:

    {
        "@^\UF701" = "noop:";
        "@^\UF702" = "noop:";
        "@^\UF703" = "noop:";
        "@~^\UF701" = "noop:";
    }
    

    Basically I needed to add the : at the end of noop and invert the order for the Ctrl + Option + Cmd + DownArrow

    Victory! Today was the first time I was trying to implement the keybinding, so I'm grateful that I found this post so quickly. Also feeling fortunate that you guys use the same custom keyboard shortcuts for moving tabs as I do!

  26. cpbotha commented on Sep 18, 2025

    @cpbotha

    @didierbrouwers Don't know what happened with Sonoma 14.4 but I finally found a solution that is currently working for me:

    {
        "@^\UF701" = "noop:";
        "@^\UF702" = "noop:";
        "@^\UF703" = "noop:";
        "@~^\UF701" = "noop:";
    }
    

    Basically I needed to add the : at the end of noop and invert the order for the Ctrl + Option + Cmd + DownArrow

    Confirmed to work on macOS 26 Tahoe as well, thank you so very much @LeonardoRick !

  27. geon commented on Apr 1, 2026

    @geon

    OMG, thanks so much! It's been driving me crazy.

    @alexmalik I'm cheering you on from afar! Pretty please, I'd love a fix.

    The workaround mentioned on the atom issue here: atom/atom#1669 (comment)

    does not work on my 10.12.5.

    Works for me in vscode on macos 15.6 (24G84)

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