iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🦊

Enhance Your Browser Workflow with ShortcutKey2URL (Chrome/Firefox Extension)

に公開

ShortcutKey2URL is a very useful extension for Chrome and Firefox that I have been using for a long time, so I would like to introduce it in this article.

What is ShortcutKey2URL?

It is an extension that allows you to open URLs, navigate, or execute JavaScript using shortcut keys.

You press a "Startup Key" to display a list of pre-configured actions, and then press the next key to execute that action.

start.gif

The following types of actions can be configured:

  • Navigate to a URL. If the URL is already open, move to that tab; if not, open it in a new tab.
  • Open a URL in a new tab.
  • Open a URL in the current tab.
  • Execute specified JavaScript in the current tab.
  • Open a URL in a new tab and then execute specified JavaScript.
  • Open a specified URL in an incognito window.
  • Open the same URL as the current tab in an incognito window.

Why it's useful

Shortcut keys are not limited to a single character

As the number of things you want to register as shortcuts increases, you might run into issues where keys overlap.
With ShortcutKey2URL, shortcut keys can be multiple characters long, not just a single character, so there's no problem even as your shortcuts grow.

For example, Google provides multiple services, and you can set them up so that the first key is G and the second key is the first letter of each service.

google.png

The system is designed so that the action is executed as soon as the shortcut target is narrowed down to one based on the characters entered in sequence.

Jump to already open tabs

There is an action called Jump to url for shortcut keys. If you specify this:

  • If the URL is already open, it moves to that tab
    • URLs are compared using prefix matching
  • If it is not open, it opens as a new tab

This is the resulting behavior.

For sites you open frequently (like X/Twitter), using Jump to url is very convenient because you can move to an already open tab without opening a new one every time.

twitter.png

Register Bookmarklets

You can register not only URLs but also bookmarklets.
Bookmarklets are specified as Execute script.

bookmarklet.png

It doesn't matter if javascript: is included or not.
(Since bookmarklets are usually written in a form that is entered as a javascript scheme in the URL bar, you can simply copy and paste them as they are.)

Execute JavaScript after opening a URL

You can also configure it to execute JavaScript immediately after opening a URL.
By entering the JavaScript you want to run in Script (optional), that JavaScript will be executed when you open or move to that URL.

script.png

For example, immediately after opening a certain site, you can:

  • Change the initial focus position
  • Enter values into input forms as initial values

These kinds of things can be achieved with this feature.

How to use

Installation

Install from the links below.

Setting the Startup Key

The default startup key is Ctrl+. (period). (On Mac, it's Command+, (comma)).
You can change it via Menu > More Tools > Extensions > Keyboard shortcuts.

change_startupkey.png

Operation

When you press the startup key, a list of shortcuts will be displayed in a popup.

popup.png

Entering a key from the list will execute the corresponding shortcut.

run.gif

Shortcut Settings

Configure shortcut keys on the options screen.

option.png

You can access the options screen via the Options link in the popup window or

goto_option1.png

from the "Options" entry in the extension menu.

goto_option2.png

Settings

Column count specifies the number of columns for the shortcuts displayed in the popup.
The left shows when 2 is specified, and the right shows when 3 is specified.

column2.png column3.png

If you check Interactive filter of shortcut keys on the popup in Option, you can interactively filter the shortcuts displayed in the popup.

interactive.gif

Shortcut Keys

By clicking Add current page, you can easily set the current page as a shortcut key.

add_current_page.png

It can also be added from the context menu.

context_menu.png

add_current_page_setting.png

In Key, set the key to be assigned as a shortcut. Multiple characters can also be used.
After pressing the startup key, pressing the key set here will execute the shortcut.

Checking Hide in shortcut key list displayed in popup allows you to hide the shortcut from the list in the popup window.
It will only be hidden; the shortcut key itself remains active.

Specify the behavior of the shortcut key in Action.
The available options are as follows:

  • Jump to url: Navigate to a URL. If the URL is already open, move to that tab; if not, open it in a new tab.
    • Checking for already open URLs is done by prefix matching.
  • Open url in new tab: Open the URL in a new tab.
  • Open url in current tab: Open the URL in the current tab.
  • Execute script: Execute the specified JavaScript in the current tab.
  • Open url in incognito window: Open the URL in an incognito window.
  • Open current tab in incognito window: Open the current tab in an incognito window.

By specifying Script (optional), you can execute arbitrary JavaScript after opening the URL.

Import / Export

The list of shortcut keys can be exported and imported.
This allows you to take backups or perform migrations (such as moving between Firefox and Chrome).

Conclusion

Some parts may overlap with what is described in the GitHub README, but I plan to add more tips here in the future if I find any.

If you have any bugs or feature requests, I would appreciate it if you could submit them on GitHub.

Discussion