Hi Mohamed,

I think that I addressed this possibility in my initial email, when I
suggested that one way would be to use a content script.

AFAIK the problem with this approach is that the keyboard shortcuts
are only active when the content area is active.  Do you agree with
this, or am I misunderstanding something?

Matt

On Fri, Sep 25, 2009 at 5:43 AM, Mohamed Mansour <[email protected]> wrote:
> Hi Matt,
> You currently can't "alter" existing keyboard shortcuts in Chrome, they are
> hardcoded within the code base.
> But, you can use plain JavaScript to add event listeners. As well, you can
> use keycodes ( http://www.expandinghead.net/keycode.html ) If you want to
> emulate ALT+SHIFT+X to any page you would do the following:
>
> var myCustomKey = 88; // Shift + x
> window.addEventListener('keyup', keyboardNavigation, false);
> function keyboardNavigation(e) {
>   switch(e.which) {
>      case myCustomKey:
>          if (e.altKey) {
>             // Do whatever.
>          }
>          break;
>   }
> }
>
> That will allow you to use your custom key listeners for an extension.
>  -Mohamed
>
>
> On Fri, Sep 25, 2009 at 1:48 AM, Matt <[email protected]> wrote:
>>
>> Hi,
>>
>> Is it possible to make a global keyboard shortcut for a chrome
>> extension?  Based on the API documentation, I don't think that it is.
>> If not, are there plans to?
>>
>> I realize that you can get some semblance of this by adding a content
>> script to each page, but that only covers cases where the content area
>> is focused.
>>
>> Two example use cases that I can think of where this is necessary:
>> 1.  Extensions which manipulate tabs.  For example, say I wanted to be
>> able to add a keyboard shortcut that would group tabs by domain, or
>> sort them in alphabetical order, etc.  Such a shortcut shouldn't apply
>> only when the content area is focused.
>> 2.  An extension which adds a keyboard shortcut that moves focus to
>> the content area.
>>
>> Ideally, the API would be as simple as:
>>
>> chrome.addGlobalShortcut("<C-y>", function() {...});
>>
>> This would be incredibly useful.
>>
>> Matt
>>
>> >>
>
>

--~--~---------~--~----~------------~-------~--~----~
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