-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Load custom xkb keymap #3999
Comments
Maybe it's not the same thing you mean, but I installed my own custom layout in |
I did that as well: custom keyboard layout in |
Local user settings for keyboard layouts can be stored in |
Confirmed to work! Thanks for the tip @progandy. I'll do that from now on. |
previously globally defined in /usr/share/X11/xkb/symbols/custom ref: swaywm/sway#3999
My apologies, I should have been more specific with my question. It's been a while since I set up my layout so I forgot about the xkb nomenclature. The thing is that my keyboard layout file not only contains an xkb_symbols section but also xkb_types and xkb_keycodes sections. This is all contained in a struct named xkb_keymap. This is the format returned by xkbcomp. I could probably get rid of the xkb_keycodes section but xkb_types is essential for me as that is where custom modifier levels are defined. So when I try to load this file by doing
So I guess my real question would be, is there any way to load an xkb keymap file? I could of course get rid of the xkb_keycodes section and put the xkb_symbols and xkb_types sections into their own files. Then I could load the symbols file with |
Accordding to https://www.vinc17.net/unix/xkb.en.html |
Yeah, but that's for X. The location of the keymap is also incidental because you can put it anywhere and then just upload it to X using |
There is no way. Maybe you can create a patch with a new configuration option that makes sway ignore the RMLVO configuration and load a keymap from a file with xkb_keymap_new_from_file
That is not straight forward. You could write your own |
I wouldn't be against a patch that uses |
Phew, my C knowledge is pretty much zero. I looked at keyboard.c and input.c and don't think I will be able to implement this at any point in the near future. Unless one of the existing developers has an interest in this, I will try to accomplish this with xkb_rules. |
Adds a new commend "xkb_file", which constructs the internal xkb_keymap from a xkb file rather than an RMLVO configuration. This allows greater flexibility when specifying xkb configurations. An xkb file can be dumped with the xkbcomp program.
Adds a new commend "xkb_file", which constructs the internal xkb_keymap from a xkb file rather than an RMLVO configuration. This allows greater flexibility when specifying xkb configurations. An xkb file can be dumped with the xkbcomp program.
Adds a new commend "xkb_file", which constructs the internal xkb_keymap from a xkb file rather than an RMLVO configuration. This allows greater flexibility when specifying xkb configurations. An xkb file can be dumped with the xkbcomp program.
Adds a new commend "xkb_file", which constructs the internal xkb_keymap from a xkb file rather than an RMLVO configuration. This allows greater flexibility when specifying xkb configurations. An xkb file can be dumped with the xkbcomp program.
I have successfully migrated from my X11 setup using xkbcomp like the OP, to Sway using the xkb_file option added through the above-mentioned commits. However, while Wayland applications load my keyboard settings, XWayland applications do not. Is it reasonable to expect Sway’s xkb_file setting to apply to XWayland windows as well? I cannot find any way to configure XWayland’s keyboard settings, so I assume the Wayland compositor passes them to XWayland. |
Yes. |
Shall I therefore reopen this Github issue, or open a new one? |
If it doesn't work, open a bug report. |
Many many thanks to @edyounis I was finally able to recreate what I had earlier done in i3 using Xmodmap. My issue was that |
First I'd like to thank you for getting this far. I have a somewhat peculiar setup and a peculiar problem with it. Basically, I've rebound the following, and get the following instead:
Heres my setup: First, CAPS (the key, not the sym) is the key i use for accessing the extra layers. This is then bound to NumLock to avoid weirdness when programs look for the caps state, and to stop the light on my keyboard blinking. The rest of the config looks at the state of NumLock, not Lock, for whether they should enter my extra layers (stored in xkb_types, of course). When a key is pressed, it is meant to redirect the keystroke to a different key (not a sym) and clear the relevant modifiers. This part is done in xkb_symbols, next to each key. One reason this seems so convoluted is I need things like caps+alt+j (caps+j is down) to look like alt+down, with no other modifiers. Similarly, I need shift+caps+x to give me ~ (caps+x gives `) with no modifiers. Here is a quick rundown of my types:
Another issue (which I don't think is this program's fault) is that only in vim it doesn't deal handle holding down movements. For instance, I hold down j and I move down once. Weird thing is I hold down downarrow and its as normal - but if I hold down caps+j, which should be exactly downarrow, it moves once. Other programs seem to handle it normally, but I thought I'd ask if you happened to know anything about why that may be before I pop over somewhere vim related. Let me know if you need me to explain how my config works any more, or if you have a nice way to implement this functionality in a non breaking way. |
Anyone can give their input on why my setup does not work as expected? Ubuntu 22.04, sway version 1.7
If I leave it as is, it does not work for xwayland apps, but works for the terminal and other apps. If I add the
It still does not work, but if I just run My .xkb can be found here, I got it by dumping it
I get some warnings and an error but it seems to be working fine otherwise.
|
I use a custom keyboard layout defined in ~/.config/xkb/custom.xkb which I upload to X using
xkbcomp ~/.config/xkb/custom.xkb $DISPLAY
. Is there any way to do the same in Sway? I triedinput * xkb_layout ~/.config/xkb/custom.xkb
but that didn't work.I guess I could register my layout globally and then just load it with
input * xkb_layout custom
but a) I'd like to do this from within my home folder and b) making a layout available like that is unexpectedly complicated; I edited both the .lst and .xml files in /usr/share/X11/xkb/rules and that didn't work. Those changes could also be gone with the next system update.The text was updated successfully, but these errors were encountered: