This works for me:

document.documentElement.addEventListener('keyup',
  function (evt) {
    if (evt.ctrlKey && evt.altKey) {
      switch (evt.keyCode) {
        case 76:  // Ctrl-Alt-L
          ..
      }
    }
  }
);


2009/9/11 Felix Geisendörfer <[email protected]>:
>
> I am trying to make an extension that adds shortcuts for the bookmark
> bar items. I want to map ctrl + <1-9> to bookmark bar item #1-9.
>
> However, I cannot find any information on how to attach keyboard
> shortcuts for extensions. The closest I found is:
>
> http://groups.google.com/group/chromium-extensions/browse_thread/thread/3da168076e1834eb/83878bc2ef708d62?lnk=gst&q=keyboard#83878bc2ef708d62
>
> Is it currently possible to register keyboard shortcuts?
>
> My current attempt has been content script like this:
>
> window.onkeypress = function(e) {
>  // do stuff
> };
>
> However, it seems like this only gets fired for regular keys, and not
> if the control key is held down.
>
> Any help would be greatly appreciated,
> -- Felix Geisendörfer aka the_undefined

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to