Disable Chrome developer tools ⌘-[0-9] keyboard shortcuts? - google-chrome

Is it possible to disable the ⌘-[0-9] keyboard shortcuts in Chrome's developer tools? It's frustrating to accidentally hit them when I intend to switch tabs (ex, when I hit ⌘-1 because I want to switch to the first tab, but instead being taken to the developer tools "Elements" panel).

Update: This feature has landed in Chrome 28.
Open the devtools.
Click on the Gears icon in the bottom-right corner
Select the General tab
Use the checkbox before "Enable Ctrl + 1-9 shortcut to switch panels" to toggle the preference. This option is found in the bottom-right corner of the Settings -> General tab.
Previous answer, which shows how to easily change the source code of your devtools.
There's no preference or flag to change the shortcuts, so you either have to edit the source code and build Chrome yourself, or change one byte in resources.pak.
First, locate resources.pak. This archive (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/7/8: %LocalAppData%\Google\Chrome\26.0.1410.65\resources.pak
If you cannot find the file at the specified path, use your common sense. Adjust the version, Chrome/Chromium for example. Locate the Chrome executable, and find resources.pak close to it.
Create a back-up of resources.pak in case you mess up.
Open resources.pak (use vim or any other hex editor).
Find _keyDown:, and move a few lines forward (see below). Change ! to ~. What does this do? For all given inputs, ~value will return a negative number, which is truthy, so the _keyDown: function always ends early.
I've confirmed that the Ctrldigit shortcut is disabled in Chrome/Chromium on Linux/Mac/Windows by following these steps.
What could go wrong?
You trashed some bytes, e.g. by using Notepad to save resources.pak.
You did not edit one byte, but added/removed a byte. Remember, the resource's size is fixed!
In any of these cases, the developer tools will show up as "Not found". Chrome itself is still usable though: Sites can be browsed. If you forgot to make a backup at step 3, re-installing Chrome will fix any issues.
For future reference, part of the source code (source with comments at InspectorView.js):
(in the boldfaced 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;
}

Related

Disable developer mode extensions pop up chrome54

I just upgrade to chrome 54 and iu'm getting this anoy pop up every time i launch chrome
I tried to use this solution:
run hiew32 demo (in admin mode) and open Chrome.dll
switch to hex view (Enter key)
search for ExtensionDeveloperModeWarning (F7)
press F3 to edit and replace the first letter "E" with any other character
save (F9).
BUT
the string ExtensionDeveloperModeWarning is not present anymore in chrome.dll
So I search and replace any string with the word Warning for larning, and still is not working.
So the problem still exist
Solution: Write a Script to open a new window as soon as chrome is opened and then close the old window.
Add the following code to your background java script file.
chrome.windows.create({type: 'normal',focused: true, state: 'maximized'}, function(window) {
chrome.windows.getAll( function(windows)
{
for(var i=0;i<windows.length;i++)
{
if(windows[i].id!=window.id)
{
chrome.windows.remove(windows[i].id);
}
}
});
} );
Note: To work as expected, after adding/installing the extension to chrome, restart chrome manually
it is not a universal solution, but there is a way for specific extensions by using the whitelist. Add the chromium adm template into the gpedit.msc, and add the ID of the develop mode extensions. Apply and restart chrome. It should be OK.
The solution can both prevent the pop-up warning and give you the permission to use some extensions not in the webstore. If you can use the develop mode extensions but suffer from the pop-up warning, it also can help you.
Sadly Stackoverflow doesn't permit me to post images and too many links, so I have to put relavant things in my blog.
http://yutouyes.blogspot.com/2016/12/using-crx-extensions-added-offline-in.html
Wish it can help.
I've tried several methods but only the one above worked.

Black-boxing script option in Chrome Developer tool

I have an issue with the Chrome developer tool.
My version is Version 46.0.2490.71 (64-bit)
According to online tutorials, I can go to Sources tab, right-click a script file and there will be Blackbox Script option to choose.
However, I see no option in my chrome. How do I enable that option since I have no knowledge about regex?
Another problem: The scripts still got debugged even though I added them to blackbox list. Weird!!
One more thing i want to ask is how I blackbox an "unlimited" amount of VM files?
Open devtools settings (press F1 once in devtools or open from the menu)
Go to blackboxing (see image below)
Add a pattern, for example:
node_modules
angular
rxjs
It uses regex syntax in case you need something more specific.
The nice part about blackboxing library/framework scripts is that it makes it easier to see in stacktraces from where the error was triggered in your own sources.
EDIT
As other pointed out, since this answer was posted you can directly blackbox a script with a right click on the source file in devtools.
However head off to the blackboxing settings UI for more control.
There's an easier way in Chrome 60 (and possibly older):
Open the source file in Chrome dev tools (in the source tab)
Right Click the column that displays the line numbers
Select "Blackbox Script"
EDIT: As svict4 pointed out, in Chrome 64, you can also right click anywhere on the script
It seems they changed from blackbox to Ignore List.
Also press f1 in devTools and find Ignore List
Not sure if Chrome has changed too, but on Chromium Edge, the option is named "Mark as Library Code" and "Mark as my Code" to disable it. You have to right click on the code and not on the file/tab. Right clicking on Line numbers works too.

Chrome extension is blocking my Javascript [duplicate]

I have recently started to see a frequent error in Chrome Dev Tools when right clicking on an element for the purposes of selecting "Inspect Element" - instead of selecting the element on the "Elements" tab the error "Uncaught Error: Parameter 2 (message) is required." appears in the "Sources" tab for a virtual "extensions:: schemaUtils" script.
The error occurs in the function "validate" as per the screenshot below.
This error seems to occur since installing the "OneTab" extension, and indeed goes away when I disable it. I have reported it to the extension author, so far without response. Unfortunately as work have seen fit to issue me with an underpowered machine, removing OneTab is not an option as memory otherwise runs in extremely short supply.
The issue is easy to replicate, within Stack Overflow itself click on the "StackExchange" icon top left, and then right click on one of the "Your Communities" items. The context menu does not open and the above error appears. This also affects the pop-out menus on the primary product I am working on.
This error only occurs in a single instance of Chrome, which happens to be my primary developer machine, and does not occur on Chrome Canary on the same computer, and with the same extension installed.
Chrome 37.0.2024.2m on a Windows 7 Professional, Service Pack 1, x64 laptop.
Do I have a corrupted copy of Chrome? Can other users replicate this error (with or without the OneTab extension)? Is there anything short of removing the extension permanently that I can do to restore essential "Inspect Element" functionality?
I have already tried resetting Chrome within the settings menu.
The problem you're experiencing is that a breakpoint is triggered for (uncaught) errors.
To stop this from happening, open the Sources tab of the developer tools, and make sure that the circle with the two stripes in it is GREY, not blue. This circle means "Pause on exception" and is the right-most icon in the next picture.
Just stating more clearly : if you are ok with that, just disable the OneTab Chrome extension.
de-activating and re-activating breakpoints in the devtools solved my issue
The breakpoints icon is in Developer Tools, on the Sources tab, the icon left of the pause button.
I also use OneTab, am on OSX 10.10.5, Google Chrome Version 46.0.2490.71 (64-bit) - other extensions I have installed are LastPass, Xdebug helper, JetBrains, Postman, DevTools Theme: Zero Dark Matrix, Google Docs (and similar)
The breakpoints solution was suggested here https://stackoverflow.com/a/25623760/1875965
You started the validation at i + 1, it should be i.
Change:
var message = "Invalid Argument for " + (i + 1) + ".";
Into:
var message = "Invalid Argument for " + (i) + ".";

Chrome/Firefox: Disable keyboard shortcuts on websites

I am using Outlook Web Access in Chrome and Firefox. On OS X, the webpage uses the keyboard shortcut Option+S for sending off the email. Unfortunately, on OS X the same shortcut is usually used to type the German Umlaut "ß". Hence, whenever I now try to type a word with that character, the website instead sends off my email. Do you know of any plugin or other means to disable such shortcuts on certain websites? Thanks!
You can tell Firefox to disable all keyboard shortcuts for websites (as well a couple other options). Look at this pref on the about:config page.
permissions.default.shortcuts (default = 0)
The values can be set as follows:
UNKNOWN: Services.perms.UNKNOWN_ACTION [0]
ALLOW: Services.perms.ALLOW_ACTION [1]
BLOCK: Services.perms.DENY_ACTION [2]
PROMPT: Services.perms.PROMPT_ACTION [3]
Note that there may be some undesirable side effects, e.g. my fn+delete macOS System function no longer works to delete the next character after my cursor... maybe there's a workaround for that?
I found this solution here:
https://support.mozilla.org/gl/questions/1241294
More context:
I had a similar problem with Outlook Web App (OWA) in Firefox on Macbook (OSX), where I want to refresh the page with cmd+r but instead OWA would interpret the shortcut as "reply" and pop-up a new window to reply to the selected message instead of simply refreshing the page.
Use an OS level tool, such as Automator, to toggle the keybindings based on the browser URL:
A guide to using OS X’s Automator to create your own software
Webkit/Safari/Firefox/API: Can I programmatically read/extract multiple tabs' URLs?
Is there a way to trigger a Hot Key/Keyboard Shortcut via a Shell Script, a AppleScript or a Automator Workflow?
MacOS, how to delete unused service item in Keyboard Shortcuts

Is there a way to add MRU tab selection via CTRL+TAB to Google Chrome? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
This post was edited and submitted for review 11 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I haven't been able to find an extension or built-in way to get this functionality.
I have seen a couple of hacks on the web, but none that work properly. Eg this standalone application:
https://github.com/acemtp/chrome_mru
Yes, there is a perfectly working solution.
This extension Tab Thumbnails Switcher can redefine Ctrl+Tab and Ctrl+Shift+Tab to select tabs in MRU order the same way you swich between programs with Alt+Tab in Windows.
The best part is that the tab selector box is implemented natively, so it doesn't need to inject javascript on each tab for it to work. It works reliably on all tabs.
There's also a demonstrative video here: https://www.youtube.com/watch?v=2HC7_EI8db4
Another option I just found Yesterday (and until now it seems to work very well) is: AutoControl Shortcut Manager: https://www.autocontrol.app/switch-to-last-used-tab-in-chrome#MRU-tabs
Steps:
Install chrome extension: AutoControl Shortcut Manager
Install also the required exe file: Native-Component.exe (It will be prompted to be downloaded after the extension is installed. For me it didn't require admin rights. I hope it's ok ...)
Configure the extension based on the tutorial (9 steps) from the official web page: Cycle through all tabs in MRU order
Enjoy ctrl+tab behavior :)
I was able to get the chrome_mru tool working by changing the nHotKeyChar variable from 0xde to 0xc0 (from tilde ~ to tick `) and recompiling.
Then I realized this is the same thing AutoHotkey does using this script with the Recent Tabs Chrome extension.
The AutoHotkey/Recent tabs solution is suboptimal, yes, but I think it is the best we can hope for until Chrome implements this feature (if ever /sigh).
I now found a possiblity to achieve this for users working on Windows and wrote an extension:
https://chrome.google.com/webstore/detail/ctrl%2Btab-mru/ialfjajikhdldpgcfglgndennidgkhik
Complete solution for setting up Ctrl+Tab to use MRU switching on Windows:
First download an MRU extension for Chrome. After trying a few different such extensions, I recommend Ctrl+Tab MRU. It's not perfect, but it's the best one I could find.
Next, you need to bind the hotkeys for your selected extension to a key combination. Go to chrome://extensions/, scroll down to the bottom of the page, click "Keyboard shortcuts", and find the shortcuts for the extension you selected. Unfortunately, Chrome doesn't let you bind Ctrl+Tab as a keyboard shortcut, so instead choose a combo that Chrome does let you select, like Ctrl+Q for "Switch to older tab" and Ctrl+Shift+Q for "Switch to newer tab".
Now we need to set things up so that Ctrl+Tab triggers the key combination you previously set. For that you'll need AutoHotkey. If you don't already have AutoHotkey, first download and install it from its website. Then, put the following text in an AutoHotkey script in your startup folder, at %AppData%\Microsoft\Windows\Start Menu\Programs\Startup\tabswitch.ahk (e.g. in a new text file located at C:\Users\yourusername\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup and named tabswitch.ahk, with no .txt extension):
; Fix for Chrome's lack of MRU tab switching.
; Use this with a decent MRU tab switching extension, like
; https://chrome.google.com/webstore/detail/ctrl%20tab-mru/ialfjajikhdldpgcfglgndennidgkhik
; Configure it to use Ctrl-Q, or change the key below.
#IfWinActive, ahk_exe chrome.exe ; If currently using Chrome
^Tab::^q
^+Tab::^+q
#IfWinActive
This remaps Ctrl+Tab and Ctrl+Shift+Tab to Ctrl+Q and Ctrl+Shift+Q, respectively, when Chrome is the currently selected Window. This will allow you to use Ctrl+Tab to switch between tabs with MRU ordering in Chrome. Don't forget to double-click the script to run it. It should start back up automatically when you reboot your computer.
There are two features enabled by Firefox's ctrltab shortcut that Chrome doesn't yet offer:
Switch to the previously used tab
Press ctrltab and then release both
Select an open tab from a menu using the keyboard
Press ctrltab but then release just tab
Press and release tab repeatedly to select older tabs in the menu
Release ctrl to switch to the selected tab
The only Chrome extension I know of that offers a facsimile of this — without requiring the unnecessarily broad Read and change all your data on the websites you visit permission and that works with tabs into which extensions can't inject code, like Chrome Webstore pages — is QuicKey (which I wrote).
QuicKey works around Chrome's limitations by using one shortcut to open the popup menu (by default, altQ on Windows), then listening for another keypress (W, right next door) to move the selection in the menu, and then waiting for the alt keyup event to switch to the selected tab.
It has to use W instead of Q (which would be the equivalent to tab in this shortcut) because pressing that with alt down would close the popup. (The popup page doesn't see that key event at all so it can't block it.) But that does mean QuicKey can use a quick double-press of altQ (or double-click of the icon) as a shortcut to toggle to the previously used tab. It does that by timing how long the popup was open, and switching tabs if the time was less than 450ms.
If you want to use ctrltab as a shortcut for switching between recent tabs in QuicKey, there's a simple, cross-platform way to do it via Chrome devtools.
I am using tab stack as a workaround until Chrome has native MRU support (crossfingers) ;)
Tab Stack (https://chrome.google.com/webstore/detail/tab-stack/gfpdghcockbpiokcaaagmnneioeopnnb) moves the current tab to the front after a brief delay. It's very simple solution that gives you kind of MRU.
Solutions above didn't work for me. Maybe b/c of an international keyboard layout.
As an alternative I would offer using FF, in it you have to set browser.ctrlTab.previews setting to true and you have an MRU behavior.
All ctrl-tab MRU options I have seen on Chrome feel like hacks / do not work reliably.
I recommend switching to latest Opera . You basically get Chrome(ium) with a few key addings (MRU tabs, but also mouse gestures).
The setting is at opera://flags/#activation-order-tab-cycling (needs restarting the browser).
Finally there is a working one:
https://chrome.google.com/webstore/detail/clut-cycle-last-used-tabs/cobieddmkhhnbeldhncnfcgcaccmehgn?hl=en
Here's a very light and intuitive solution for tabs organizing in the most recently used order, which is supported in all major browsers (Chrome, Firefox, Opera, other Chrome-based browsers): Tab Slider. Its features are:
Works just like Alt+Tab on Windows or Cmd+Tab on Mac, but with browser tabs
Visually sorts tabs so you always see them in the MRU order (Ctrl+Tab switches to the next MRU tab)
Works with pinned tabs as well
Is customizable (however, I would advise sticking with defaults)
Try it! Hope you'll love it.
For mac users you can use this extension:
chrome extension
It has a shortcut opt+y to cycle through previous tabs. And if you want to use ctrl+tab as shortcut, you can use karabiner element tool to map the opt y shortcut to ctrl tab.
the mapping i use for karabiner is like so:
{
"from": {
"key_code": "tab",
"modifiers": {
"mandatory": [
"left_control"
]
}
},
"to": [
{
"key_code": "y",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
}
Yes there is a working solution available now. I found Recent Tabs extension perfect for MRU tabs solution in chrome. You can use ctrl+Q or ctrl+~ or assign your own.
Better to use http://bahoom.com/hyperswitch as jason3w suggests
My solution:
On OSX I usually want MRU switching when I want to repeatedly switch between two chrome tabs and a code editor. (For example, trello.com and localhost:3000)
In this case, I start up chrome canary which is properly treated as a separate application by OSX, and allows for a simple alt-tabbing (like windows used to), SWEET!!
https://www.google.com/chrome/browser/canary.html
Try it out, peeps. I tried the Opera solution, but just couldn't live without some of the other features of chrome. I hope Opera continues to develop.
Is there a real working solution to add MRU tab selection via CTRL+TAB
to Google Chrome?
Yes. You need to modify Your preferences file as like here:
http://forum.ru-board.com/topic.cgi?forum=5&topic=34987&start=4680#16
(change Your sequence to Ctrl+Tab and Shift+Ctrl+Tab)
Chrome does not block it. You simply cannot assigh this combination becouse of hook.. But if You edit Preferences file, it works.
It is situated near
"C:\Users\%username%\AppData\Local\Google\Chrome\User
Data\Default\Preferences"
Just found this https://github.com/acemtp/chrome_mru
Its goal is to enable you to use CTRL+TAB in Google Chrome with the
Most Recently Used (MRU) Tab behavior (and not the default
next/previous tab).
I didn't try it so far. Hope it helps
edit reason: Stopped working.
On Mac OS, the Recent Tabs extension is somehow able to reassign Ctrl+Tab to switch between two most recently used tabs out-of-the-box!
https://chrome.google.com/webstore/detail/recent-tabs/ocllfmhjhfmogablefmibmjcodggknml
The tricky solution to achieve this on Windows is to combine Quick Tabs chrome extensions and AutoHotkey script. I've described it in details here, so here is in a nutshell:
1) Quick Tabs is an open-source, customizable extension, that allows you redefine some CSS styles and allows to setup hotkey for switching MRU tabs. Also it supports keyboard navigation (move to next/previous tab). However chrome doesn't let you bind Ctrl+Tab as a keyboard shortcut, so you need to register another one (for example Ctrl+Shift+S) and then use AutoHotkey script to "remap" Ctrl+Tab for chrome into Ctrl+Shift+S.
2) I won't put here the AutoHotkey script, you can find it here. It covers Ctrl+Tab remapping and handle all the keyboard navigation.
As a result you will see something like that when press Ctrl+Tab in active chrome window:
Arrows navigation, Esc, both Ctrl+Tab and Ctrl+Shift+Tab are working the way you expected.
Best workaround I have found on mac/linux is to install a extension that sorts the tabs in MRU order*, so that ctrl+tab works the way you'd expect it to:
https://chrome.google.com/webstore/detail/tab-slider/nobaaibkcalggmjnjhnlmmcldllpogjp
* last used tab is moved to all the way to the left