1

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).

vdegenne
  • 12,272
  • 14
  • 80
  • 106

1 Answers1

0

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.

Zaz
  • 46,476
  • 14
  • 84
  • 101