Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending single fake key to webpage #4271

Open
kontheocharis opened this issue Sep 30, 2018 · 6 comments
Open

Sending single fake key to webpage #4271

kontheocharis opened this issue Sep 30, 2018 · 6 comments
Labels
component: keyinput Issues related to processing keypresses. priority: 2 - low Issues which are currently not very important.

Comments

@kontheocharis
Copy link
Contributor

Would it be possible to have a bind setting such that pressing a key would enter a mode in which the next key (only) would be sent to the web page?

For example, if that key is "n", then pressing "nf" would send "f" to the webpage.

Using fake-key for this would require binding every single key as such:

:bind na fake-key a
:bind nb fake-key b
:bind nc fake-key c
...

Is this possible to do without such repetition? (I'm assuming it isn't with the normal binding mechanism but is there a way to 'hack' it using config.py?)

Thanks.

@ninewise
Copy link

Well, you can bind n to enter-mode passthrough ;; later 1000 enter-mode normal. Then you'll enter passthrough mode for a second.

@mschilli87
Copy link
Contributor

@noctuanivalis: But if that was a real command I'd expect to be able to do something like 2NAOI to send a and o to the web page and then enter insert mode... 😉

@ninewise
Copy link

ninewise commented Oct 1, 2018

Mine is just a silly workaround, an actual command to do this would be better indeed.

@kontheocharis
Copy link
Contributor Author

Basically, to achieve this properly, some sort of command arguments are needed:

bind n* fake-key *

@The-Compiler
Copy link
Member

I guess another possibility would be a mode similar to passthrough mode, but which automatically exits itself after handling a key. That'd probably be a much easier solution than implementing bindings with dynamic arguments.

@The-Compiler The-Compiler added component: keyinput Issues related to processing keypresses. priority: 2 - low Issues which are currently not very important. labels Oct 1, 2018
@kontheocharis
Copy link
Contributor Author

As a temporary solution, I've added this to my config.py:

import string

pass_key = 'a'
for l in list(string.ascii_lowercase):
    config.bind(pass_key + l, 'fake-key ' + l)

It's not perfect and only accounts for the base alphabet, but it works for the things I need (like youtube fullscreen & other controls).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: keyinput Issues related to processing keypresses. priority: 2 - low Issues which are currently not very important.
Projects
None yet
Development

No branches or pull requests

4 participants