fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.31k stars 117 forks source link

Please add a key binding for Firefox #147

Closed WJCFerguson closed 5 years ago

WJCFerguson commented 5 years ago

A keyboard shortcut is a key feature for many users - we are usually at the keyboard typing when we decide we want the external editor. Please implement one for Firefox.

Issue #113 was closed as fixed by removing the keyboard shortcuts. As noted in that issue, a user-editable shortcut depends upon Firefox development, but a statically defined one should still be possible.

Apologies I don't know the landscape well enough to suggest a solid candidate.

fregante commented 5 years ago

Apologies I don't know the landscape well enough to suggest a solid candidate.

That's the problem.

WJCFerguson commented 5 years ago

Between the Firefox hotkey page and the Wikipedia general shortcuts page, I see very little on ctrl+alt. How about ctrl+alt+O - (I'm thinking 'open'), or ctrl+alt+E ('edit')?

What other issues need to be considered? Other conventions or clashes?

wosc commented 5 years ago

If you're willing to type in a string describing the shortcut into a preferences textfield, e.g. literally Ctrl+Alt+E (which I use and like a lot for this feature ;), it is perfectly possible to customize an extension shortcut -- at least that's how https://github.com/jlebon/textern does it, and I can attest that it works just fine.

fregante commented 5 years ago

I didn’t consider adding the UI to the extension. Anybody here willing to send a PR to add this field to the options page? It’d have to somehow validate the shortcut (i.e. not accept random values)

Better yet, just capture the shortcut this way without having to type it:

https://github.com/s4kr4/react-input-shortcut/blob/521f0e0fe367eabb771077b13ce5b0809fdb0e42/src/InputShortcut.js#L59-L85

josswright commented 5 years ago

Sitting in Firefox on Linux here, I can see that "Ctrl+Alt+E" certainly isn't assigned. I'd so much rather have a shortcut that might conflict in some cases than the current state of no shortcut at all. It seems that adding a UI to alter the shortcut is a larger task, and in the meantime we have the worst of all worlds where there's no shortcut at all.

If at all possible, could I ask that we have back the 'imperfect' keybinding solution until the more complex 'perfect' UI option becomes available? (Ctrl+Alt+E seems a viable option, and even if it might conflict for some people, at least default Firefox+GhostText users will be able to benefit.)

fregante commented 5 years ago

Yep, the suggestion is accepted if implemented like in my previous comment. PR welcome 🙂

josswright commented 5 years ago

I don't quite understand. My comment was asking if we could (please!) have a fixed keybinding restored until someone has the time to write the whole editable/UI option.

josswright commented 5 years ago

Just following up on this again. Would it be possible to re-enable a (non-editable for now) shortcut for Firefox until someone has time to implement the UI? Ctrl+Alt+E seems to have consensus as a good choice.

Thank you!

fregante commented 5 years ago

Send a PR for that. Firefox did indeed add the UI now

josswright commented 5 years ago

Apologies -- I'm not familiar enough with writing Firefox addons to do that.

knu commented 5 years ago

I got Firefox 67.0 to load this extension (the latest source tree) from about:debugging#addmins to see it listed in the Manage Extension Shortcuts page, set a shortcut via the UI successfully, but the main feature of the extension did not seem to work though it looked like I was able to invoke the Toggle command by the shortcut key I selected. Is there a working build I can give a try?

Lenbok commented 5 years ago

@fregante PR #159 created, but I am having the same issue as @knu (Firefox 68.0.2, when running via temporary extension neither the shortcut nor button works) - is there another way to create/load the extension locally?