Update: This feature has landed in Chrome 28 .
- Open devtools.
- Click the Gears icon in the lower right.
- Select the General tab
- Check the box next to "Enable Ctrl + 1-9 to switch panels" to switch preferences. This option is located in the lower right corner of the "Settings β General" tab.
The previous answer, which shows how easy it is to modify the source code of your devtools.
There are no preferences or flags for changing shortcuts, so you need to either edit the source code, create Chrome yourself, or change one byte in resources.pak .
First find resources.pak . This archive (the format described here ) contains several static files. resources.pak is located in the following directory:
- OS X 10.7.3 :
/Applications/Google Chrome.app/Contents/Versions/26.0.1410.65/Google Chrome Framework.framework/Resources/resources.pak - Linux (ArchLinux):
/usr/lib/chromium/resources.pak - Windows XP :
%AppData%\..\Local Settings\Application Data\Google\Chrome\26.0.1410.65\resources.pak - Windows Vista /
%LocalAppData%\Google\Chrome\26.0.1410.65\resources.pak : %LocalAppData%\Google\Chrome\26.0.1410.65\resources.pak
If you cannot find the file at the specified path, use your common sense. Correct the version, for example Chrome / Chromium. Locate the Chrome executable and find resources.pak next to it.
Back up resources.pak if you mess up.
- Open
resources.pak (use vim or any other hex editor). - Find
_keyDown: and move a few lines forward (see below). Change ! on ~ . What does it do? For all given inputs, ~value will return a negative number, which is true, therefore the _keyDown: function always ends earlier.
I confirmed that the Ctrl digit shortcut is disabled in Chrome / Chromium on Linux / Mac / Windows by following these steps.
What could go wrong?
- You deleted a few bytes, for example. using Notepad to save
resources.pak . - You did not edit one byte, but added / deleted bytes. Remember that the size of the resources is fixed!
In any of these cases, the developer tools will appear as "Not Found." Chrome itself can still be used: sites can be viewed. If you forget to back up in step 3, reinstalling Chrome will fix any problems.
For future reference, part of the source code (source with InspectorView.js comments):
(in the bold line replace ! with ~ )
_keyDown: function (event)
{
if (! WebInspector.KeyboardShortcut.eventHasCtrlOrMeta (event))
return
if (! event.shiftKey &&! event.altKey && event.keyCode> 0x30 && event.keyCode <0x3A) {
var panelName = this._panelOrder [event.keyCode - 0x31];
if (panelName) {
this.showPanel (panelName);
event.consume (true);
}
return
}
Rob w source share