HaNdTriX
HaNdTriX

Reputation: 29756

Let the user choose the keyword for my omnibox chrome extension

I just created a chrome extension using the omnibox api.

"omnibox": { "keyword" : "a" },

I found out that it is not possible to use multible keywords or let the user choose a keyword for my extension although the extension is listed on the search engines settings page:

Chrome extension Bug

I addition to that the priority of the extension keyword is by far the lowest. If a User already defined a keyword in the Default search engines / Other search engines - sections the extension keyword is not usable.

Does anyone know a solution for at least one of these issues?

Maybe by using the NPAPI?

Upvotes: 11

Views: 1204

Answers (3)

Maltronic
Maltronic

Reputation: 1802

For some extensions I have found it necessary to edit the extension source directly. Often this is available on GitHub or similar a repository.

  1. Clone source to a directory on your computer
  2. Open the manifest.json file in the extension's route directory. Edit or add this section:

    "omnibox": { "keyword" : "key" }

Where "key" is the keyboard shortcut key itself.

  1. In chrome, go to: chrome://extensions/
  2. Delete the old extension (careful of deleting important data if relevant)
  3. Switch on developer mode in top right of page
  4. Select Load unpacked extension... and navigate to the cloned directory
  5. Verify the extension has loaded in Chrome and works correctly
  6. It is a security risk to browse the Internet with Chrome Extensions developer mode left on. Solve this by packing the extension into a single .crx file (a type of .zip file).
  7. Delete the newly created "unpacked" extension and click Pack extension... (you can sign the file with a .pem key but this is not necessary).
  8. Switch off developer mode in top right of page
  9. Nagivate to the directory above the cloned directory
  10. Drag the .crx file produced in the packing step onto the Chrome window
  11. The new extension should now appear on the chrome://extensions/ page
  12. Verify the correct result by navigating to chrome://settings/ -> Manage search engines...
  13. At bottom of page under "Search engines added by extensions" the keyboard shortcut should be updated and extension only appears once

Upvotes: 2

Cory Gross
Cory Gross

Reputation: 37206

I'd like to let people know that it appears that this has changed and is no longer the case. I was exploring this possibility myself and found this page stating it wasn't possible. In order to change the keyword for my extension after installation I took the following steps:

  1. Right click the omnibox (address bar) and select Edit Search Engines
  2. Scroll to the very bottom (optionally deleting half of the really long list of sites you'll find)
  3. Under the section for keywords for installed extensions, find the extension you wish to edit and click the keyword value to the right of it's name. There is no edit button, it will turn into an editable field.

Edit Omnibox Keyword

I am using Chrome version 30.0.1588.0 on Windows, but I am not sure how long this has been editable.

Upvotes: 1

AxGryndr
AxGryndr

Reputation: 2344

This discussion has come up before and you can see an example of it here - https://code.google.com/p/chromium/issues/detail?id=75890.

It seems that the reason there is only one title:keyword pair is to prevent an over abundance of key words. There also does not appear to be any support that would allow for the end user to change this pair.

Upvotes: 2

Related Questions