wlr-protocols icon indicating copy to clipboard operation
wlr-protocols copied to clipboard

Add wlr-keyboard-modifiers-unstable protocol

Open harishkrupo opened this issue 6 years ago • 16 comments

Signed-off-by: Harish Krupo [email protected]

harishkrupo avatar Nov 18 '18 02:11 harishkrupo

I think I'm still -1 on this protocol tbh.

ddevault avatar Nov 18 '18 13:11 ddevault

I think I'm still -1 on this protocol tbh.

Do you have any suggestions to improve it? Any other way to get modifiers then?

harishkrupo avatar Nov 18 '18 14:11 harishkrupo

I'd just like to add my support for this as a user. I constantly switch between three languages that require distinct layouts, and it's super helpful to have my status bar display the current one. I get that this protocol might seem too specific, but I feel like it addresses an important point. Thanks @harishkrupo for putting in the work for this, and @emersion and @ddevault for giving feedback and guidance!

lovesegfault avatar Nov 26 '18 13:11 lovesegfault

As a DE dev, I would also like to vouch for the usefulness of this protocol.

AdrianVovk avatar Jan 17 '19 16:01 AdrianVovk

the protocol should probably be extended to get all the configured layouts (so that you can have a pop-up menu with all the layouts), and also to switch to another layout.

gdamjan avatar Jan 26 '19 15:01 gdamjan

I'd just like to add my support for this as a user. I constantly switch between three languages that require distinct layouts, and it's super helpful to have my status bar display the current one. I get that this protocol might seem too specific, but I feel like it addresses an important point. Thanks @harishkrupo for putting in the work for this, and @emersion and @ddevault for giving feedback and guidance!

afaict this protocol does not fulfill this use-case. But you can fulfill this use-case anyway by just listening for keymaps on wl_seat, right?

ddevault avatar Jan 26 '19 15:01 ddevault

afaict this protocol does not fulfill this use-case. But you can fulfill this use-case anyway by just listening for keymaps on wl_seat, right?

@ddevault, Does wl_seat advertise keymaps? I don't see any event for that here: https://gitlab.freedesktop.org/wayland/wayland/blob/master/protocol/wayland.xml#L1663

harishkrupo avatar Jan 27 '19 10:01 harishkrupo

I think that this protocol needs to be extended to be also able to switch the current layout (and possibly enumerate all layouts, if there is no other way to do that).

ammen99 avatar Jan 27 '19 10:01 ammen99

But you can fulfill this use-case anyway by just listening for keymaps on wl_seat, right?

No, because when you switch the layout, the keymap doesn't change (it contains multiple layouts). Instead, the modifiers change. We do send modifiers, but only to the currently keyboard-focused surface. So bars aren't notified.

Does wl_seat advertise keymaps?

See wl_keyboard.keymap.

I think that this protocol needs to be extended to be also able to switch the current layout (and possibly enumerate all layouts, if there is no other way to do that).

Is it possible at all to programatically switch layouts using the libxkbcommon API? EDIT: seems like it, since you know the number of layouts and you can set modifiers.

Enumerating all layouts is possible client-side using the libxkbcommon API. It gives names like English (US) though, not things like en.

Oh, and this protocol should include a keymap event too, since there's no guarantee it's sent to unfocused clients in the protocol.

emersion avatar Jan 27 '19 10:01 emersion

Enumerating all layouts is possible client-side using the libxkbcommon API. It gives names like English (US) though, not things like en.

https://github.com/xkbcommon/libxkbcommon/issues/22 people suggested parsing evdev.xml (part of xkeyboard-config)

gdamjan avatar Jan 27 '19 16:01 gdamjan

people suggested parsing evdev.xml (part of xkeyboard-config)

All right. In any case, it doesn't belong to this protocol, and should be done client-side.

emersion avatar Jan 27 '19 16:01 emersion

Does the xkb state sent by the compositor also contain the list of enabled layouts?

ammen99 avatar Jan 27 '19 16:01 ammen99

Does the xkb state sent by the compositor also contain the list of enabled layouts?

Yes.

emersion avatar Jan 27 '19 16:01 emersion

Extending this a bit: what if a client (bar or shell) wants to listen to e.g. KEY_VOLUMEDOWN, KEY_VOLUMEUP or KEY_POWER. If we want to allow clients to handle this we might need a protocol to send certain input events to special clients (maybe using a whitelist in the compositor so clients can request certain input events but only get access to them if whitelisted).

agx avatar Jan 30 '19 10:01 agx

Extending this a bit: what if a client (bar or shell) wants to listen to e.g. KEY_VOLUMEDOWN, KEY_VOLUMEUP or KEY_POWER. If we want to allow clients to handle this we might need a protocol to send certain input events to special clients (maybe using a whitelist in the compositor so clients can request certain input events but only get access to them if whitelisted).

Related: https://patchwork.freedesktop.org/patch/172113/

Note that in sway, we handle this by running commands instead of having some kind of "keybind protocol".

emersion avatar Jan 30 '19 10:01 emersion

wlr-protocols has migrated to gitlab.freedesktop.org. This pull request has been moved to:

https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/31

emersion avatar Nov 01 '21 10:11 emersion