xkbcommon / libxkbcommon

keymap handling library for toolkits and window systems
https://xkbcommon.org
Other
278 stars 124 forks source link

xkbcli is poorly documented. Please document it better (without requiring web/net access) with use cases and examples, and explanation of its tech jargon ( ELI5 ) #243

Closed shlomif closed 1 year ago

shlomif commented 3 years ago

xkbcli is poorly documented. Please document it better (without requiring web/net access) with use cases and examples, and explanation of its tech jargon ( ELI5 ).

I was referred to its man page by Nate from https://bugs.kde.org/show_bug.cgi?id=429045 and could not understand what I should do (despite my decades of tech and linux/unix experience. )


[shlomif@localhost ~]$ xkbcli --version
1.0.1
[shlomif@localhost ~]$ inxi -CSG
System:
  Host: fedora Kernel: 5.11.16-200.fc33.x86_64 x86_64 bits: 64 
  Desktop: Xfce 4.14.4 Distro: Fedora release 33 (Thirty Three) 
CPU:
  Info: Quad Core model: Intel Core i5-8259U bits: 64 type: MT MCP cache: 
  L2: 6 MiB 
  Speed: 700 MHz min/max: 400/3800 MHz Core speeds (MHz): 1: 700 2: 709 
  3: 3385 4: 2467 5: 939 6: 1860 7: 1451 8: 998 
Graphics:
  Device-1: Intel CoffeeLake-U GT3e [Iris Plus Graphics 655] driver: i915 
  v: kernel 
  Display: server: Fedora Project X.org 1.20.11 driver: loaded: modesetting 
  unloaded: fbdev,vesa resolution: 1920x1080~60Hz 
  OpenGL: renderer: Mesa Intel Iris Plus Graphics 655 (CFL GT3) 
  v: 4.6 Mesa 20.3.5 
[shlomif@localhost ~]$ 
whot commented 3 years ago

what part of the xkbcli man page (and its sub-pages) was not clear enough?

bluetech commented 3 years ago

Actually xkbcli does not make it possible to set the XKB layout of the desktop environment. On Wayland currently each compositor has their own settings for that.

On gnome it's gsettings get org.gnome.desktop.input-sources sources and similar settings. I am not familiar with KDE personally, but a DDG search suggest something like qdbus org.kde.keyboard /Layouts setLayout "us".

shlomif commented 3 years ago

On Wed, 28 Apr 2021 00:13:36 -0700 Ran Benita @.***> wrote:

Actually xkbcli does not make it possible to set the XKB layout of the desktop environment. On Wayland currently each compositor has their own settings for that.

On gnome it's gsettings get org.gnome.desktop.input-sources sources and similar settings. I am not familiar with KDE personally, but a DDG search suggest something like qdbus org.kde.keyboard /Layouts setLayout "us".

Thanks, Ran!

--

Shlomi Fish https://www.shlomifish.org/ https://github.com/shlomif/what-you-should-know-about-automated-testing

The Blues Brothers are on a mission from God. God is on a mission from Chuck Norris. — https://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - https://shlom.in/reply .

bluetech commented 3 years ago

OK, I'll close this now, but if there are more specific complaints feel free to reopen.

hickford commented 2 years ago

If it helps anyone else, here a links to xkbcli man pages:

dcunited001 commented 1 year ago

@bluetech For me, it's not entirely clear what I should do with the xkbcli compile-keymap output. I've tried searching the source and tests for references, but nothing really uses the output.

fwiw, i know that sway can be given the *.xkb file output with xkb_file, which I have running on one system.

For this computer, i'm using KDE and i just switched over to a wayland-based session. I tried searching for relevant strings in the my user dbus session, but nothing's coming up.

i'll look at the above references. the man pages are alright, but it's more like I don't know how xkbcli fits into the wider ecosystem nor do i fully understand how tools in the wider ecosystem will expect things to work in wayland. much of that is out of scope for xkbcommon (and would result in redundant/stale docs anyways).

i've had interest in XKB forever, but it's always been confusing. there are a ton of improvements that i'm looking forward to once i get xkbcommon figured out. i may be able to run kmscon on some systems, for example. and it's finally possible to have user-level keyboard configs that (fingers crossed) should be somewhat portable from system to system.

i also eventually need to get xkbcommon *.xkb output working with fcitx or moz, but fcitx i'm not trying to whine, but it's just a PITA to get things like this set up.

dcunited001 commented 1 year ago

I just looked at the tests again and there's better information than I thought, but there's nothing that indicates what happens after xkbcli compiles the keymap.

my intuition is telling me the keymaps should go in ~/.config/xkb/keymap[s], but I'm not sure. it might be that xkbcommon doesn't make any assumptions about where you put the compiled output.

this isn't really a place for a conversation, so i might open an issue to actually get help.

wismill commented 1 year ago

@dcunited001 I think that xkbcli compile-keymap is primarily aimed for test & debugging:

there's nothing that indicates what happens after xkbcli compiles the keymap.

From the manual:

xkbcli compile-keymap compiles and prints a keymap based on the given options.

Nothing is expected to happen after printing the keymap.

i also eventually need to get xkbcommon *.xkb output working with fcitx or moz,

I do not think these applications should consume this output. They should probably just use the the xkbcommon API. I invite you to consult the quick guide.

dcunited001 commented 1 year ago

thanks @wismill I was a bit confused. i guess it's a non-issue. I keep hitting the capslock key every five seconds lol.

I've dug deeper into the content and found that the xkbregistry fills the role of evdev.xml, which is a huge relief. I guess I just need to check the source of various repos to ensure they implement xkbregistry. I just need to look into how KDE and xwayland load custom keymaps.

I have several installs, but I'm trying to generally move towards wayland on all of them. I was worried that I would need to run commands for many applications when my keyboard config changes.

wismill commented 1 year ago

I do not understand what you try to accomplish. If you are looking to load custom layouts, I suggest you look at User Configuration. This works perfectly in KDE with a Wayland session. You do not need to use xkbcommon directly: leave it to KDE.

Please state your use case(s) clearly, else we won't be able to help you.

wismill commented 1 year ago

Reading again, this issue is too messy to be actionable. Please feel free to open new issue(s) — one by topic — defining first the context and your aim, before writing about experiments and issues.

Above all, be specific. We also appreciate an effort to sum up a minimal reproductible test case.

dcunited001 commented 1 year ago

@wismill I've got xkbcommon working now. I had assumed that because I had used XKB that I didn't need to read the documentation carefully. sorry about that

dcunited001 commented 1 year ago

i should've started by copying the examples into the $XDG_CONFIG_HOME/xkb directory and changing it until I got what I needed.