Skip to content

Instantly share code, notes, and snippets.

@m0se
Created November 30, 2017 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0se/f41ac86c623d67679e293571f3b9ca57 to your computer and use it in GitHub Desktop.
Save m0se/f41ac86c623d67679e293571f3b9ca57 to your computer and use it in GitHub Desktop.
kill brave browser keyboard shortcuts

Workaround to stop Brave from interfering with OS shortcuts

Motivation

I have been looking forward to use Brave as main browser for a Year now and wasn't able to as I wanted to keep using my OS hotkeys for switching workspace Ctrl+[1-9] which Brave takes over when in focus for tab-switching.

Following the Issue brave/browser-laptop#1374 I didn't got the impression that this will be fixable via the config ui soon. So I took a look at the code, to see if there is a simple workaround and turns out there is.

Instruction

  1. Find and backup the app.asar in your local Brave installation

  2. Install the asar tool via npm:

npm install asar
  1. Unpack the app.asar archive in to a directory:
mkdir /tmp/app
asar e /usr/lib/brave/resources/app.asar /tmp/app/
  1. Edit and delete or comment out the Hotkeys that interfer with your OS Hotkeys in /tmp/app/app/localShortcuts.js

In my case for Ctrl+[1-9] I did the following:

delete this entire line (line 26):

['CmdOrCtrl+9', messages.SHORTCUT_SET_ACTIVE_FRAME_TO_LAST],

comment out the following block:

...
/*
  // Tab ordering shortcuts
  Array.from(new Array(8), (x, i) => i).reduce((list, i) => {
    list.push([`CmdOrCtrl+${String(i + 1)}`, messages.SHORTCUT_SET_ACTIVE_FRAME_BY_INDEX, i])
    return list
  }, simpleWebContentEvents)
*/
...

  1. Put it back together, by packing the directory to its original location within the Brave installation:
asar p /tmp/app /usr/lib/brave/resources/app.asar
  1. Start Brave again and test. Now I can finally start using Brave ;)
@gruvin
Copy link

gruvin commented Jan 14, 2018

Nice! Thank you.

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