-
Notifications
You must be signed in to change notification settings - Fork 278
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
XKB groups and layout changes are not supported on Linux #650
Comments
Plover does not handle keyboard layout changes on Linux (and never has). The layout is parsed one time at initialization. The XKB code provided by |
The layout isn't changed while Plover is running (I've changed the steps so that's clearer). Looking at this more closely, there seems to be a global keyboard layout and some more local layout. Prior to that commit, the local layout didn't have any affect on Plover's output. After that commit though, it does affect the Plover's output but Plover is only aware of the global keyboard layout, so whenever the layouts are different, there's a problem. The global keyboard layout can be changed with setxkbmap. The local one can be changed with KDE System Settings, but setxkbmap also changes it. I suppose injecting the events into the window skips that local layout remapping. |
FWIU, there's a global server layout. You can also have per device layouts (including one for the fake XTest keyboard device). And then a layout can have XKB groups, which can be switched per application. Usually, DEs will configure a global layout with multiple XKB groups (one per language configured), and change group per application. Plover only has access to the equivalent of |
That makes sense and is quite helpful to know. I do find it a bit strange there was no problem before. |
@benoit-pierre I have a keyboard with a non-standard arrangement of keys so the keycodes don't map to the expected physical keys. I don't want to alter the global XKB layout as that would mess with my normal ability to type. If I wanted plover to use a different mapping, would my best bet be to directly alter xkeyboardcontrol's |
Key bindings can be changed within the program's options; you don't need to touch the source.
|
@nimble0 The configurator seems unwilling to accept modifier keys (namely: shift and control) as bindings. Are you aware of a workaround for that? |
I did make a fix for that, unfortunately I won't have access to it for a few weeks. There are a few issues that held me off from making a pull request for it:
- I didn't have an OS X or Windows environment for testing.
- A modifier key like control will cause issues if used in the strokes that activate plover (because shortcuts will activate before plover knows to block it). Also can be problematic if you try to use a stroke while not realising that plover is currently inactive.
- Occassionally, I have noticed shortcuts activating when they shouldn't which could be caused by the fix. This is rare enough and not distrupting enough that I haven't been particularly motivated to look into it more (I use this fix full time).
I think the fix roughly involves this:
- Add appropriate entries to KEYCODE_TO_KEY in this file https://github.com/openstenoproject/plover/blob/master/plover/oslayer/xkeyboardcontrol.py
- Add appropriate entries to SUPPORTED_KEYS_LAYOUT (must match name used in KEYCODE_TO_KEY) in this file https://github.com/openstenoproject/plover/blob/master/plover/oslayer/keyboardcontrol.py
- Remove "if modifiers == 0:" on line 240 in file https://github.com/openstenoproject/plover/blob/master/plover/oslayer/xkeyboardcontrol.py . This line prevents Plover from doing anything while a modifier is active.
|
@nimble0 Thanks muchly, I've got my layout working perfectly. One thing of note though, I was unable to get mapping changes to stick in the master (v4.0.0.dev0) branch. Fortunately, as v3 shares the |
Yes, that should be a separate issue. That bug appeared with the new Qt interface so I think it's just that no-one has gotten round to adding the UI bindings to save those settings.
|
Logged in [a new issue]. Thanks for all your help. |
I might be wrong, but Xlib seems to kind of know what the layout currently is, while xtest just assumes completely differently for one reason or another. When I do Looking around for some temporary solution, I've replaced |
A keysym is not a keycode. |
Sorry I understand that. I fixed a typo, I miss-typed |
I have two questions, for those that might know:
|
|
There are a number of tricky issues with running Plover in this configuration: - Plover is not fully compatible with Wayland at this point - Based on the way Plover works at this time [1], setting keyboards to use Dvorak in Wayland (via SwayWM) results in Plover's output being filtered through the Dvorak layout, which scrambles the letters. This script attempts to workaround these issues by: - Referencing a version of Plover that is installed in a virtual environment - Running a console-based version of Plover [2] (that is really wonderful) - Reloading the SwayWM config which effectively resets the keyboard layout used by Plover for unknown reasons. This hack may be analagous to [3] (as mentioned in [4]). [1] openstenoproject/plover#650 [2] https://github.com/psethwick/plover_console_ui [3] https://github.com/benoit-pierre/config-x11/blob/d9a4be44976a96488a9046f2f6cc91649f35d6f0/bin/setxinput.sh#L171 [4] openstenoproject/plover#788 (comment)
Classification: Bug
Reproducibility: Always
Summary
Emulated keystrokes are affected by KDE keyboard layout remapping.
Steps to Reproduce
Expected Results
Output string "the".
Actual Results
Output string "ghf".
Version
Plover version 4.0.0.dev0
First appeared in commit 2419313.
Installed via: Git
Notes
The cause seems to be in _send_keycode, specifically the change from target_window.send_event to xtest.fake_input.
Issue #298 is similiar but this bug appeared later.
Standard Qwerty layout behaves correctly.
Configuration
OS: Linux Mint 17, KDE 4.13.3
The text was updated successfully, but these errors were encountered: