Assign the Shortcut key for Chrome Extension Option page - google-chrome

How can I assign my Google chrome extension option page with shortcut key.

The following works almost as good as a shortcut,
Go to location bar, press Ctrl+L
Type "ce" OR "cs",
Press Enter.
After setting it up as follows,
What I do is, I set them up as search engines on
chrome://settings/searchEngines
Name - Shortcut - URL Chrome Extensions - ce - chrome://extensions/
Name - Shortcut - URL Chrome Settings - cs - chrome://settings/
http://productforums.google.com/forum/#!topic/chrome/hqYtz15LrgQ
Hope this helps!

Currently there is no better way other than injecting content script to all pages with keypress listener. As you would imagine this approach not only isn't very effective, but wouldn't work on some pages (chrome://newtab would be the most annoying one).
Unless assigning a shortcut to your options page is crucial, I wouldn't bother doing it.

I think the options page is meant to be open only from the extension control panel links. However, to solve the shortcut part of the problem you can use the new commands API which will free you from having javascript listeners injected on every page. The shortcuts will work even if you don't have a page loaded in your tab.

You could use this autohotkey script:
#IfWinActive, ahk_class Chrome_WidgetWin_1 ; Shortcut functions only on Chrome
^q::Send, ^t chrome://extensions/ {enter} ; functioning script
#IfWinActive
The second line is the script and means that if you press Ctrl+q (^ stays for Crtl) the script opens a new Tab (Ctrl+t), type the address (chrome://extensions/) and press enter.
You can change the shortcut key changing what is before the ::.
Then I suggest you to put the file .exe in the startup folder.

Related

Ctrl-N in emacs keybindings for Jupyter notebook in Chrome

I'm using Jupyter notebooks in the Chrome browser. I've installed nbextensions and am using the emacs keybindings. Most keys work as expected, even those that conflict with Chrome shortcuts, like ctrl-P. But ctrl-N still opens a new window. I've tried Shortkeys, with which I can set ctrl-N to "do nothing", but it is not passed through to the notebook. I tried AutoControl Shortcut Manager and have the same problem.
Old answers to this question say that you can't override ctrl-N at all, which is no longer true in the newer versions of Chrome, but how do you stop the default behavior and allow the key to pass through to the page?
You can do this with AutoControl Shortcut Manager by using the SYNTHESIZE INPUT action to send a synthetic Ctrl+N from the inside of the webpage.
That way, the webpage will respond to the shortcut but not the browser.
This is how you do it:
Set Ctrl+N as the trigger
Choose SYNTHESIZE INPUT as the action and enter the keystroke Ctrl+N
Select option Send from the inside of webpage
Now, whenever you press Ctrl+N, Chrome will do nothing, but the webpage will receive the keystroke and will react to it.
Of course, you'd only want to do this on those Jupyter Notebook pages, so make sure you add a URL condition to that trigger.

Keyboard shortcut to access Chrome bookmarks (mac)

I seem to be almost entirely mouse-free at this point, minus being able to access the Bookmarks bar in Chrome with a keyboard shortcut! I've searched the web quite a bit for an answer, but to no avail....any ideas or workaround?
EDIT: Use Firefox. You can CMD + B --> will open Bookmarks navigator, and you can type to search, hit TAB, and then arrow through results
If you are hoping to click on the actual bookmarks on your Google Chrome browser, using keyboard shortcuts, on Mac, you can make use of Mac's Keyboard shortcuts feature.
Open System settings app
Open Shortcuts section under Keyboard
Choose App shortcuts
Click +
Choose Google Chrome as application
On the title field, enter Bookmarks->{Bookmark-name-goes-here}
Set a hotkey
Save the changes and you can now use this hotkey to call that bookmark. This basically is setting a shortcut to your browser's menu item.
Holmes is an extension that allows a shortcut activated bookmark search similar to Garrett's answer but without the "read and change all the data on any websites that you visit" permission.
Install the tool then press shift+alt+H
⌘ + Option + b
or
⌘ + Shift + b
Try this shortcut
cmd+opt+B
I found a chrome plugin that is super useful and goes beyond what I was hoping for. It's called Bookmark Navigator. Here is the link https://chrome.google.com/webstore/detail/bookmark-navigator/bfibpphfhdpgkmbpkfmhdiklgcfmmkha
Below is a picture of what it looks like. The tool is summoned with cmd + b, and then you can start typing to search all of your bookmarks. You can press enter to access the bookmark at top of list, or use arrow keys to navigate further down the list.
This is the fastest and most user friendly option I have found.

How to copy cookies in Google Chrome?

Is there any way I can copy/edit the cookies in Chrome Developer tools? Or do I need to install a custom add-on for this?
I think I have found something. I can press Ctrl+A and Drag & Drop the values in a TextBox and then copy it from there.
As pointed by #jmccure,
Ctrl+A, hold Shift and right click and copy.
Update: Chrome 58 added a support to edit cookies
Cross-browser Solution:
Hit F12 or Right-click page and Inspect to open the Developer Tools
Click the Application Tab (which used to be called Resources)
Open Cookies on the left, select your site/domain
Double-click cookie column Value
CTRL/Command + C or Right-click and select Copy
An alternative approach to copy a long cookie value:
Repeat the request with the Network tab open.
Right-click the relevant request (in the list on the left-hand side).
Choose Copy as cURL.
Extract the cookie from the generated Cookie header option.
For example: curl 'http://...' -H 'Cookie: session=...' ...
If you have a lot of cookies and you don't want to install any plugin, I created a small script to avoid copying the cookies one by one.
It was tested only in Google Chrome.
// Open the console in the developer tools
// Tab where you are getting the cookies from
// This block can be just copy and paste
let cookies = document.cookie;
cookies = cookies.split(";");
cookies = cookies.map(cookie => cookie.replace(" ", ""));
copy(cookies);
// Tab where you want to have the cookies
// This block cannot be copy and paste since there is no function to paste
const newCookies = // paste your cookies array here
newCookies.map(newCookie => {
document.cookie = newCookie;
})
This sounds strange, but if you hold Shift and right click, it seems to work most of the time.
I use the Edit this Cookie extension for Google Chrome, which is very nice.
According to its documentation:
EditThisCookie is a cookie manager. You can add, delete, edit, search,
protect and block cookies!
You have to select the value and then you can copy it. Double click helps, but if there are some delimiter characters (e.g. ".", "-" etc.) then you have to triple click it (at least in Windows 10).
So basically:
select the value (double or triple click)
copy the selection (Ctrl+C or "Copy" from context menu)
Unfortunately, there doesn't seem to be any reliable way to do this from developer tools. Right clicking the value and choosing copy sometimes works, but not if there are delimeter characters.
One workaround is to go into the js console and print document.cookie. Unfortunately, that only works for non HTTP_Only cookies.
Another combination that works: Click on cookie value. While holding the left mouse button, click right button thrice. The Copy command will now appear in the shortcut menu.
I wanted to copy my Instagram session to another browser. So I went this way successfully.
On the source browser
Hit F12 / go to Dev Tools
Go to the network tab
Reload the page / hit F5
Scroll up to the very first entry (document http/200)
Click it and go to the headers tab
Find the cookie header and right click / copy value
On the target browser
Go the other browser and hit F12 / go to Dev Tools
Go to the console
Type ''.split(';').forEach(c => document.cookie=c);
Paste your cookie value between the single(!) quotes and hit ENTER
Reload the page / hit F5

How to disable chrome extensions JS when debugging in devtools?

When I add mouse event breakpoint, devtools always jump into extension's JS.
Is there any way to point to my mouse event code directly?
The only way to disable the script (e.g. to avoid side-effects) is by disabling the extension (for instance, by using incognito mode if the extension is not enabled in incognito mode).
If you don't mind the scripts to run, but want to ignore extension code, then you can use the script blackboxing feature of Chrome's devtools.
If you never develop extensions and aren't interested in stepping through it, then open the settings menu of the devtools, click on Blackboxing and then the "Blackbox content scripts" checkbox:
If you only want to selectively ignore files, then you can also right-click on the source of the file that you want to ignore, and click on the "Blackbox Script" contextmenu option. To remove the pattern, go to the "Blackboxing" settings panel as shown before.
I think the simplest way is to open an incognito window (Ctrl-Shift-N) (or Cmd-Shift-N for mac) and debug in there, because then there will be no extensions loaded (by default).
I know what you mean by this question: when debugging, and doing something simple like pausing execution, you always find it breaks into one of the extension's codes instead of the current webpage's code.
open developer tools, then go to settings and then click on ignore list, and check the checkbox for add content script to ignore list, then add this to the ignore list: ^chrome-extension://
If you're using Google Chrome (or any Chromium-based browsers), simply run a new browser instance with a fresh user's data directory.
On Linux:
google-chrome --user-data-dir=$(mktemp -d)
This way, all extensions will be disabled without having to manually switch off/on them.
I like to use Profiles for that.
While changing into incognito mode might help you to disable most of the extensions, some of them might be allowed and still run. For example I have DarkReader and Ublock enabled in incognito mode.
My favorite workaround is to use a "Guest" profile or to create a profile that you can use for debugging. I think it is easier than creating a Framework Ignore List inside of devtools.
How to create a profile: https://support.google.com/chrome/answer/2364824
Example: My debugging profile
First off you should probably review the tutorial on how to debug chrome extensions here:
http://code.google.com/chrome/extensions/tut_debugging.html
When in doubt, you can always use the debugger keyword directly in the JavaScript code where you want to launch the debugger from, like so:
element.addEventListener("mouseover", function() {
debugger;
// some JS handler code...
});
Depending on if your JS is in a popup, background page, or in a content script, you will need make sure you launch the dev tools from the right place.
For a popup, you need to right click on the extension icon and "Inspect Popup" and then from the JavaScript console you would need to run location.reload(true)
For a background page, you need to go to the extensions settings page, chrome://settings/extensions, turn on developer mode, expand the extension in question and click the background page link.
The content script should be visible directly from the page it is loaded onto.

How can I assign shortcuts that activate the different installed Chrome Extensions?

I have a few extensions (with their icons up on the right). I'd like to assign a shortcut for activating each one of them, i.e. a shortcut that simulates clicking the mouse on them.
One extension e.g. is a dictionary and it would be more than useful to be able to open it without tinkering with the mouse.
There's a way to do this in chrome://extensions if you go to the bottom of the page and find "Configure commands" link.
I also am wondering about how to do this, and here is the possible solution suggested by Misha Kupriyanov:
https://plus.google.com/u/0/108214193841489989707/posts/2YBaEqRsCPw
You can take the Quick Disable Chrome extension by +Paul Kinlan (you can find the source on github)
It uses the chrome.management API http://code.google.com/chrome/extensions/management.html
and now you can write your own pageAction extension ;) = include on each page your JavaScript for catching keyboard events and triggering enable/disable events via chrome.management API
Also check out the Vimium (also open source) by Ilya Sukhar (i am not sure its his account)
Try Autohot, it's a free tool that makes it easy to automate that kind of things, easiest would be:
wait for your "keyboard shortcut" to be fired
check that google chrome is the active window
click on the fixed mouse coordinate to activate the extension