-
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
xkb_file setting does not apply to XWayland windows #5461
Comments
Your bug report is missing debug logs. Please add a link to the full debug log file. |
Also attach your xkb_file source, please |
I attach both here. sway.log and (renamed so that Github will accept it as an upload) xkb.dump.txt The log describes launching a Sway session, opening Alacritty and typing into it (my xkb_file settings are applied correctly), then launching XWayland-based Emacs and Firefox (the xkb_file settings are not applied), and finally closing the session. I see that in the past Firefox and Sway have not played together nicely, and the fault was on Firefox’s side. However, another application where the xkb_file setting fails to apply is urxvt, so I can confirm this is an issue with XWayland windows generally. (If requested, I can upload a new log in which urxvt is opened.) |
Hmm, I have just solved my issue of not being able to remap some keys, because they were defined in the |
I had the same issue when my custom keymap (specified using keymap-file: xkb_keymap {
xkb_keycodes { include "evdev+foo" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+inet(evdev)+us+raine" };
xkb_geometry { include "macintosh(macbook78)" };
}; I discovered that was due to a weird error in my I run When I fixed the error, my keymap works under XWayland apps too. @CRCulver, I compiled your keymap file - I only see warnings, no errors. Are there no errors on your machine? xkb_keymap {
xkb_keycodes { include "evdev" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_geometry { include "pc(pc105)" };
xkb_symbols {
include "pc+inet(evdev)+us"
key <TLDE> { [ F ] };
};
}; |
I am having the same problem. In my case, the xkb file is completely written from scratch and has no inclusions. The problem is most easily visible by comparing the behavior of
In case it matters, this is the input specification:
I tried removing the "generic choice" block and applying pbp-qwerty-nofn.xkb to all |
This log covers: started up a fresh session of I'm using sway 1.5.1. |
Update: With sway 1.6, I do get a flood of xkbcomp-related messages. These are supposedly warnings, but...
Only four of these keysyms appear in my .xkb file.
Running I'd really appreciate advice on how to debug this further. |
Further update: I instrumented the xkbcomp executable to log its command line. This revealed that Xwayland is using The full command line for all three invocations is:
Then I changed the instrumentation to record what gets supplied on standard input. The first and third time, it's this:
And the second time, it's a normalized version of the file I specified as So that pretty clearly determines why the xkb_file setting isn't effective in Xwayland windows: the third invocation of xkbcomp overwrites the desired keymap with these defaults. The "could not resolve keysym" warnings are a red herring; they are the natural result of The bug, then, is that the first and third invocations of xkbcomp are happening at all, and I'm still hunting for why. |
Now I have instrumented the Xwayland executable, so it's run with The first invocation of xkbcomp happens during server initialization, before it gets around to asking the compositor for anything related to keyboard configuration, which is not a surprise. The second and third invocations happen right after each other and right after it does query for keyboard configuration:
OK, what exactly went wrong loading the keymap? My first suspicion was that there was something wrong with Xwayland's ability to read and write files in
This is not a case of "Xwayland can't handle xkm files that are bigger than 4096 bytes" because the "default" keymap generates a xkm file that's 12368 bytes long, and that one gets read in fully. Rather, Xwayland objects to something within the first 4096 bytes of the file. |
I feel like there ought to be some way to get Xwayland to print more detail about what it thinks is wrong with the xkm file, but I have been fiddling with the command line options for ages now with no luck, and the battery's about to run out on this troublesome laptop, so I'm just going to upload all three of the xkm files that get generated (1 and 3 are not identical, despite having been generated from the same input, ugh) and maybe someone else has a clever idea? |
N.B. At this point I am 99% sure sway isn't doing anything wrong, this is Xwayland's fault, and/or my custom xkb file is somehow incorrect in a way that neither xkbcomp nor the XKB processing within sway/wlroots itself cares about, but Xwayland does. |
After source-diving Xwayland a bit I have found the root problem. Since I wrote my xkb file from scratch, I didn't bother with "virtual" modifiers, assuming that I could do everything I needed with the numbered modifiers ( Adding virtual_modifiers lines to the "types" and "compatibility" sections of the file (and tinkering with the "interpret" directives a bit) makes Xwayland happy, and Recommendation: document that if you're going to use |
This seems to fix Xwayland being broken (#1). Fix source: swaywm/sway#5461 (comment)
@zackw thank you for your research. Could you post a working xkb_file of yours for reference purpose please? |
Ah, yeah, I've encountered this before as well. Sway is a little more permissive in the xkb files it accepts than xwayland, and that can be very confusing. Is there a way we can tell when xwayland rejects a keymap? Not sure if we should reject these, but would definitely be worth printing an error. |
Xwayland probably prints something already? |
It might yeah, I don't remember. |
Yes, I can confirm having encountered this while creating my fully custom keymap from scratch, for example one thing I found was that Sway doesn't care about the length of the identifiers, but XWayland (and proper XOrg as well if I recall correctly) refuses to accept anything longer than four characters for keys. I was able to discover this by continually trying to compile my keymap using |
The xkb_file setting was introduced to close bug #3999, by which a user had reported that he was unable to load a keyboard map created as the output of xkbcomp. While setting xkb_file does make such a keyboard map apply to Wayland applications, input in XWayland windows still does not respect this keyboard map.
The xkb_file setting should ensure that the same keyboard map is applied to input in both Wayland applications and XWayland windows.
The text was updated successfully, but these errors were encountered: