-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Hotkeys are keyboard layout dependent #45
Comments
Russian keys work fine (edit: or they should, never tested this, but unicode input works with other keyboard layouts), as long as you remap them in input.conf. Key bindings are text based: they follow what would appear if you typed into a text field, and they don't go by keycode or physical position or whatever. In theory, we could add the missing russian characters to input.conf to make sure that it just works even when using a russian keyboard layout. (Yeah, that'd require duplicating almost every keybind entry.) Why not just use an ASCII keyboard layout? I don't know how russian keyboards work, but not being able to type ASCII must be extremely annoying, especially when typing English text, using the command line, etc. |
I do use an ASCII layout, but I have to switch between Russian and ASCII (US English for me). What I was talking about is maybe allowing scancodes or some solution that is completely keyboard layout agnostic. |
In general, it's not possible to be perfectly keyboard layout independent, because, well, different keyboard layouts might not even have the same physical keys. I don't really get why using scancodes would be simpler than just adding additional cyrillic bindings. The scancodes would most likely not work as expected on arbitrary other keyboards (and even then, they would map to arbitrary keys) - so it'd still be something every user has to do on his own. I wonder if there's a way to force a different keyboard layout for a specific window? Or maybe it would be possible to run some sort of daemon, which switches the keyboard layout based on the foreground window? |
Scancodes should work on any keyboard, or at least any HID compliant one. |
On Sa., 16. Mär. 2013 18:02:00 CET, wm4 notifications@github.com wrote:
I know at least GNOME can do this, as well as Windows. However, in GNOME's case it may be necessary for the application to support it. Have not tried it it works for mpv. |
Looking at the code, it would be quite annoying to support both the current key binding scheme and binding via scancodes at the same time. Though it might be possible to do.
Applications only get "keycodes" on X (additional to keysyms, which have been translated by the keyboard layout). They are defined to be in the range 8-255, and otherwise nothing is said about their value. I don't know if they map to what HID defines (maybe?), or if this could even be made portable to Windows and OSX.
Do you know more about this mechanism, maybe what it is called? |
I also found this: https://github.com/qnikst/kbdd/ Apparently it remembers keyboard layouts per-window. Changing the window switches the keyboard layout. And it's independent from gnome. (I haven't actually tried it.) |
K900, does any of this help? |
Sorry for lagging behind, I ended up just adding mappings for Cyrillic 2013/3/19 wm4 notifications@github.com
|
Looking at it myself, it didn't seem easy (you'd have to drag around both keycode and scancode or so), but I'm looking forward to your patch. |
Yeah, that's the main problem I've run into. Also had some fun with trying 2013/3/20 wm4 notifications@github.com
|
Since I don't have any Android device, I never tested if it works on Android. Since Android's libc is completely broken from what I hear, I can see problems cropping up. Also, it's likely that the only VO that works on Android is vo_sdl (requires SDL 1.3/2.0). |
Bionic isn't really broken, it doesn't have some stuff glibc has, but 2013/3/20 wm4 notifications@github.com
|
Ping? |
Ouch. I think the spam filter ate the previous email. I've set it up with
|
Closing due to inactivity. Again, it's not generally possible to be independent of keyboard layout, no matter what you do it will always cuse inconveniences in one way or another. |
Is there anyway to script keyboard layout change after launching MPV? That would be most convenient way to deal with it at least for Windows which has keyboard layout state for each program (basically). |
I made workaround for my usecase input_bindings = """""" # paste here from https://github.com/mpv-player/mpv/blob/master/etc/input.conf
eng = """~QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?`qwertyuiop[]asdfghjkl;"zxcvbnm,./"""
rus = """ЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,ёйцукенгшщзхъфывапролджэячсмитьбю."""
for line in input_bindings.splitlines():
if not line.startswith("#"):
continue
keybind, *rest = line.split(" ", 1)
if keybind == "#":
continue
keybind = keybind[1:]
keys = keybind.split("+")
new_keys = [key.translate(key.maketrans(eng, rus)) if len(key) == 1 else key for key in keys]
if new_keys == keys:
continue
print("+".join(new_keys), next(iter(rest), "")) |
For example, pressing 'F' when a Russian keyboard layout is used will result in 'А' (Cyrillic), and mpv will not accept that as a hotkey.
The text was updated successfully, but these errors were encountered: