Open cnt0 opened 1 month ago
~
❯ event_data='some,strange,name,layout'
~
❯ echo "${event_data%,*}"
some,strange,name
~
❯ echo "${event_data#*,}"
strange,name,layout
~
❯ echo "${event_data##*,}"
layout
But if we're talking about this - there are apparently layouts with commas too e.g.:
https://gist.github.com/MahouShoujoMivutilde/8a12c0d40e7b262f2c78ef6e01193542
because who cares about keyboard names anyway
I care*, because wtype, power button, my bluetooth headphones and possibly other unexpected things are "keyboards".
Here is wtype working:
activelayout>>cvirtualkeyboard,English (US)
activelayout>>cvirtualkeyboard,English (US)
activelayout>>cvirtualkeyboard,none
activelayout>>cvirtualkeyboard,error
* but it's obviously not mutually exclusive thing where we all have to settle to some ONE event to rule 'em all.
This is indeed a very annoying issue for IPC clients. I see the event is posted in InputManager.cpp:
and two other places in this file.
We could maybe replace the ','
in this line with something like a ;
, but I feel this is not a very robust as some keyboard names or layout could contain a ;
as well.
Maybe a better solution could be to escape the existing commas in the keyboard name and layout with a \
? Does that make sense to do?
Description
Hello. Hyprland IPC has the following event emitted on the layout change
KEYBOARDNAME
andLAYOUTNAME
are separated by comma. The problem is thatKEYBOARDNAME
can contain commas as well. At least it does in my case, it starts withmistel-co.,ltd.-
.Such behavior complicates parsing, for example, shellevents can't correctly handle it right now.
I believe that instead of polluting IPC clients with workarounds we can fix the IPC itself. For example we can introduce the
activelayoutv2>>LAYOUTNAME
event, because who cares about keyboard names anyway. But I'd listen to suggestion first.