raffaeleflorio / qubes-url-redirector

This browser extension, designed for Qubes OS, blocks and/or redirects non whitelisted URLs to another qube of your choice.
GNU General Public License v3.0
35 stars 3 forks source link

to consider: Add keyboard shortcut. #21

Open raffaeleflorio opened 6 years ago

raffaeleflorio commented 6 years ago

As suggested in #18 is useful to have the possibility to define custom shortcuts. For example one for dispVM and one for open-here. Obviously it is intended for redirect to less trusted VMs.

raffaeleflorio commented 6 years ago

Because Javascript could simulate keypress and click, this feature will be analyzed really careful.

rugk commented 6 years ago

Because Javascript could simulate keypress and click,

I doubt though web pages could trigger an add-on shortcut, that would be a major problem of the browser. Also WebExtensions should be separated against each other, too.

What you may need is https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands, but it can only define static shortcuts. Adjusting them could be harder… (I also got back to static ones for now: https://github.com/rugk/offline-qr-code/issues/54) Maybe a lib for that could prove to be useful as it may be a thing many add-ons need to do.

raffaeleflorio commented 6 years ago

I doubt though web pages could trigger an add-on shortcut, that would be a major problem of the browser. Also WebExtensions should be separated against each other, too.

I tried, in a naif way, to trigger the extension command with Javascript, however the browser doesn't forward the event to the add-on... This is good. Nonetheless I'd like to find some official resource, or I'd like to try some other way..

What you may need is https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands, but it can only define static shortcuts. Adjusting them could be harder… (I also got back to static ones for now: rugk/offline-qr-code#54)

Thanks for the link, but these shortcuts needs to be associated with the click on an link. Probably adjusting isn't feasible.

Maybe a lib for that could prove to be useful as it may be a thing many add-ons need to do.

I think that only an official API could be really useful: for example with dialog to allow overriding of key combinations and so on.. However some hacky solution could be written, but I think that a lot of issue will arise..

rugk commented 6 years ago

but these shortcuts needs to be associated with the click on an link

Well… you can just then trigger a JS injection and then check whether a link is selected or so.

In any case I would always prefer specifying that in the JSON or so (via WebExtension commands). As you said, otherwise it may be hard to prevent websites from triggering that.

A needed lib would be just for having an UI to adjust the setting and the shortcut (i.e. this here). I.e. only the settings part. Obviously you have to use the commands API.

raffaeleflorio commented 6 years ago

Well… you can just then trigger a JS injection and then check whether a link is selected or so.

In any case I would always prefer specifying that in the JSON or so (via WebExtension commands). As you said, otherwise it may be hard to prevent websites from triggering that.

Exactly, but for this reason I excluded this approach.

A needed lib would be just for having an UI to adjust the setting and the shortcut (i.e. this here). I.e. only the settings part. Obviously you have to use the commands API.

Now I understand what you meant. :+1: