How do I get a keyboard shortcut to translate a google chrome webpage? Not looking for auto-translate options - google-chrome

I need to frequently translate the webpage manually for work purpose. Although not looking for auto-translate options, I need a keyboard shortcut or a handy extension to translate the page. The right click option on google or the google chrome translator extension need multiple clicks in order to translate. The middle mouse button to translate the whole web page would do some good to me.
I tried looking out for extensions out of which context menus was related to my issue. I couldn't figure out how it works.
The right click option on chrome has 7th option for translate page which is not handy. I need it to be the first option on right click or the middle mouse button to translate the google page would help.
I am working on windows and not MAC.

Related

Create a keyboard shortcut to Google Lens

Recently there is this "Search images with Google Lens" in the contextual menu (triggered from the right click) in Chrome browser, which is super useful.
For those who doesn't know yet, if you click on that item you can define a screenshot area and then Google Lens page opens with the image you just framed. And then it lets you search for "things" inside this image.
What I try to do is to find a way to assign a hotkey to trigger that menu item without being forced to use the mouse (e.g. ctrl + alt + s). The reason I want to do that is because I overuse this functionality and I am in a keyboard-over-mouse increase productivity mind of set.
My first thinking was to make a page script that would trigger that contextual menu and click the item but as far as I know there is nothing in the JavaScript API with that much power
(There is this " JavaScript - simulate click on contextmenu " but they are not talking about the native Chrome contextual menu I believe.)
Another option would be to use some key automation program like AutoHotKey in windows but there is one problem, the contextual menu is not always located in the same position relative to the mouse (e.g. if the menu is triggered at the bottom of the page it will appear above the mouse pointer).
Other than that I don't really see another solution.
I am digging for some idea and maybe you could help me if you are interested in the same outcome.
EDIT: For whoever may be interested
I made this python script
https://github.com/vdegenne/lens-clicker
It works on my computer, I can now get the result I want. But I keep this question opened for more ideas, seeking a better solution.
(You can also contribute to the project on the GitHub page).
I use Vimium, an extension to allow vim-like keybindings for browser navigation.
You can add search engines, for example Google Lens as so:
i https://lens.google.com/uploadbyurl?url=%S Google Lens
So once I have the URL of the image in the clipboard, I type o, i, Space, Ctrl + v, Enter
I'm working on finding a way of getting the URL of the image, but am not sure Vimium supports this. If not, using the URL template (above) to search Google Lens is still a much more robust way than by automating clicks on a menu, so hopefully that's helpful.

Chrome: Is there a keyboard shortcut for going back in a new tab?

Say I opened a link from Google search results within the same tab. Now I want to keep my newly-opened website there and go back to my search results in a separate new tab. Intuitively it could be Ctrl+Backspace but apparently this isn't the case.
You can ctrl+ click the back arrow on the browser. But I don't think there's a purely keyboard combination like ctrl+backspace. At least not from my research.

Display Chrome extension popup at middle of page

I am new to writing chrome extensions and was wondering how can i do the following.
How can i make the popup(when someone clicks on extension icon) display at the center of the webpage instead of displaying the popup at the top right corner ?
Use chrome.browserAction.onClicked.addListener(), which fires "when a browser action icon is clicked." Then inject your popup manually into the DOM of the supplied tab, using something like chrome.tabs.executeScript().
Also consider adding a context-menu item, which might make more sense to a user depending on what your extension actually does.

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

Shortcut (programmatically) open a link in a new tab without focus to that tab

Google search + Google Chrome browser have this implemented, when you browse the google search results using your up and down arrows (only possible in Chrome browser) and than press CTRL+ENTER it opens the search result selected in a new tab but without focus to that tab. You can now use up and down keys in the same list of search results and CTRL-ENTER more results in new tabs to visit later on.
Does anyone have any idea how this is done? As it only works with Google Chrome at the moment I suspect something is added to the browser as well but I can't find anything on this subject.
The way I have seen this done before is for the webpage to listen for key presses (e.g., j/k) and simply focus() the desired link. Then, when the user presses Enter or Ctrl-Enter, he is simply performing the default operation on the focused link.
Sure enough, when I type this into the javascript console on a Google search result page, I see the links that are being focused.
document.addEventListener('focus', function(e) {console.log(e.target)}, true);
So Google is still using the same technique, although it's not so obvious because they hide the dotted outline around the focused link using CSS (a.noline{outline:0}).