Creating Hotkeys in Firefox for bookmarks (bookmarklets)

6

6

I would like to set up shortcuts (hotkeys) for several Firefox bookmarks (they're actually bookmarklets). One example is the pinboard.in bookmarklet. Does anyone know how to do this?

jdigital

Posted 2012-02-09T00:51:31.900

Reputation: 861

The keyconfig extension described in the referenced article partially works. The instructions are wrong (or perhaps difficult to follow). When properly configured, a shortcut key will work, except NoScript seems to block it (unless the page is unblocked). Clicking on the bookmarklet does not seem to be affected by NoScript, and I'd like the same to apply for the shortcut. – jdigital – 2012-02-09T04:57:06.637

Answers

6

Initially, my solution was to assign a keyword to a bookmarklet and then use AutoHotkey to automate the following steps: pressing Ctrl+L to select the address bar, typing in the keyword, and pressing Enter.

This works great with normal bookmarks, as you will be taken to a new page. However, with bookmarklets that work with the current page, this is clumsy and moves the keyboard's focus. So, in an effort to avoid the address bar altogether, I've devised the following solution.

Setup:

  1. Create a new folder in the Bookmarks Menu. Since we will be using the keyboard, give it a name that can be accessed with one keystroke, i.e. the first character is unique. I chose .Hotkeyed.

  2. Move your bookmark to this folder, renaming them to begin with a character. This character will be used as part of the hotkey. For example, a : Bookmark.

  3. Now, let's be sure we can click the bookmark using the keyboard. Pressing Alt, B, . should nagivate like so:

    bookmark menu

    and pressing a should click the first bookmark.

AutoHotkey Script:

Why press four keys, when you do it in less?

#a:: ;Win+A
KeyWait, LWin ; Win+Alt alone does nothing.
Send, {Alt} ;Menu >
Send, b ;Bookmarks >
Send, . ;.Hotkeyed >
Send, a ;Bookmark 1
Exit

iglvzx

Posted 2012-02-09T00:51:31.900

Reputation: 21 611

As of 2019 the above syntax no longer works. See the AutoHotKey docs for up to date syntax. Idea works with updated syntax. – Josh Diehl – 2019-09-10T02:57:38.547

Thanks for your reply. This works but it changes the contents of the address bar. Can you find a way to restore the address bar to its original contents? – jdigital – 2012-02-09T19:04:04.063

@jdigital Sure! I will update the script. – iglvzx – 2012-02-09T19:06:59.710

Hold on... I have a better idea which avoids the address bar altogether. – iglvzx – 2012-02-09T19:23:08.517

@jdigital Updated. Let me know if this works for you. :) – iglvzx – 2012-02-09T20:00:53.113

1Great idea: placing the bookmarklet in a menu location that is accessible by single letter navigation. The IfWinActive code doesn't work for me, but you've provided enough information here to allow me to solve the problem. Thank you! – jdigital – 2012-02-09T20:53:13.370

1@jdigital Ah. I sometimes have problems with #IfWinActive, too. I'll remove it, since it is not strictly necessary. You're welcome! – iglvzx – 2012-02-09T21:03:30.037

Is the KeyWait really needed? – jdigital – 2012-02-09T21:22:41.200

[Win] may interfere with [Alt], so I use it as a precaution. You can try with and without Keywait to see if it makes a difference for you. – iglvzx – 2012-02-09T21:28:14.303

Works for me without KeyWait. BTW, I think the problem with #IfWinActive is the SetTitleMatchMode. If I use the IfWinActive ahk ... then it seems to work. – jdigital – 2012-02-09T22:40:38.700

@jdigital Thanks for the tip! I will read up on the documentation and play around with it. – iglvzx – 2012-02-09T23:08:58.200

This is a great idea. I might use this for my mouse gestures. However, oftentimes I would like to use an easier-to-remember keyword to execute a certain bookmarklet, like "qr" for my QR-code bookmarklet. I used to do that by typing it into the address bar, but Firefox made that impossible, and I can't restore that function (tried every about:config and Noscript tip I could find). Do you happen to have any idea how I could make that work? – Cerberus – 2012-05-01T16:36:55.493

The only think I can think of is making a complicated menu structure for all my bookmarklets and using Inputbox in AHK to convert "qr" into the right sequence of keys to navigate the menus...but that would be a lot of work. – Cerberus – 2012-05-01T16:38:43.587

1

You can have actual keyboard shortcuts for bookmarklets in Firefox. All you need is Keyconfig - an add-on which allows you to rebind Firefox keyboard shortcuts.

Follow these steps:

  1. Install Keyconfig
  2. Edit your bookmark and add a unique keyword in the keyword field
  3. Open Keyconfig (Ctrl+Shift+F12)
  4. Click Add a new key
  5. Paste following code into the text area below the name: getShortcutOrURIAndPostData('KEYWORD').then(function(result){loadURI(result.url);});
    replacing KEYWORD with the keyword you added to your bookmark, then click OK
  6. Select that small text field under the list and press a key combination that you'd like to bind to your bookmark
    • If a message pops up saying that this combination is already used - you can find and disable the action that is already bound to it, or choose another combination
  7. Click Apply and you're done. You can add another shortcut or close Keyconfig window

MacGyver

Posted 2012-02-09T00:51:31.900

Reputation: 15

Thanks a lot, MacGyver! Combined with my answer here, this brings back the functionality of the disappeared "Open Chromeless" extension. And I even already had the Keyconfig addon installed, but in an older version – so second thanks for pointing out the updated version: +1 for your answer :)

– Izzy – 2016-11-22T15:18:34.837

Glad to be of help. :) – MacGyver – 2016-11-30T16:40:18.197

1

Although this is not quite what you are asking, it might be of interest. I do the following:

  • right click on the bookmark you want
  • select copy from the menu
  • go to the desktop
  • right click on the desktop and click paste shortcut
  • right click on the shortcut once it is in place, select the Web Document tab and enter the short cut you want in the Shortcut Key field.
  • click OK - you are done (if you like you can change the name of the shortcut on the desktop to include the description of the short cut, e.g. "CTRL+ SHIFT + G - Google")

Advantages: works with no installation of add-on; allows you to summon up the link even if you are not in firefox; you can use any shortcut that does not clash with something else, and are not restricted to CTRL 1-9 or something

Disadvantage: you end up with a bunch of shortcuts sitting on your desktop; if you delete the shortcut you have lost the "keybinding"

Hope this helps

user379761

Posted 2012-02-09T00:51:31.900

Reputation: 11

1

Once a keyword is assigned to the bookmarklet the standard way works, ie. typing the keyword and pressing Enter. What may be misleading is that FireFox doesn't display the bookmarklet in the location bar popup. But it works. Tested on FF 39.

Say you want to use SuperGenPass bookmarklet. Assign it a keyword, say sgp and it may be launched from location bar by typing sgp and pressing Enter.

gadamiak

Posted 2012-02-09T00:51:31.900

Reputation: 11

0

Try AutoHotkey (not only for Firefox but for any application...)

climenole

Posted 2012-02-09T00:51:31.900

Reputation: 3 180

We need to know an operating system first. AHK is for Windows. – iglvzx – 2012-02-09T04:30:48.370

1I'm running Windows. I've written AHK scripts, but can't figure out how to write a script to activate a Bookmarklet. – jdigital – 2012-02-09T04:40:39.390

0

There is a Bookmark Shortcut Keys addon for Firefox.

Access Bookmark Toolbar items with a keyboard shortcut. The default is Control+1-9. Change it in the preferences.

zany

Posted 2012-02-09T00:51:31.900

Reputation: 109

This extension works for bookmarks, but doesn't seem to work for bookmarklets. – khamer – 2016-04-27T13:57:25.413

I'm using this extension just for bookmarklets. But I noticed it will only work if the bookmark toolbar is visible. – zany – 2016-04-27T14:43:02.460