Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

hyprland/language: incorrect language parsing

Open mexanoz opened this issue 1 year ago • 3 comments

The issue seems related/similar to #3222. Waybar seems to not parse the layout name correctly when it has commas in it, which causes it to display an empty string instead of the language indication. In this case, the offending layout name is "English (intl., with AltGr dead keys)". Correct behavior:

[2024-07-30 19:46:48.254] [debug] hyprland IPC received activelayout>>at-translated-set-2-keyboard,Russian
[2024-07-30 19:46:48.322] [debug] hyprland language onevent with Russian
[2024-07-30 19:46:48.322] [debug] hyprland language update with full name Russian
[2024-07-30 19:46:48.322] [debug] hyprland language update with short name ru
[2024-07-30 19:46:48.322] [debug] hyprland language update with short description ru
[2024-07-30 19:46:48.322] [debug] hyprland language update with variant
[2024-07-30 19:46:48.322] [debug] hyprland language formatted layout name ru

Incorrect behavior:

[2024-07-30 19:47:23.460] [debug] hyprland IPC received activelayout>>at-translated-set-2-keyboard,English (intl., with AltGr dead keys)
[2024-07-30 19:47:23.514] [debug] hyprland language didn't find matching layout
[2024-07-30 19:47:23.514] [debug] hyprland language onevent with  with AltGr dead keys)
[2024-07-30 19:47:23.515] [debug] hyprland language update with full name
[2024-07-30 19:47:23.515] [debug] hyprland language update with short name
[2024-07-30 19:47:23.515] [debug] hyprland language update with short description
[2024-07-30 19:47:23.515] [debug] hyprland language update with variant
[2024-07-30 19:47:23.515] [debug] hyprland language formatted layout name

Note also that this only happens when switching the keymap and it works correctly when launching Waybar with this layout selected:

[2024-07-30 19:50:01.138] [debug] hyprland language update with full name English (intl., with AltGr dead keys)
[2024-07-30 19:50:01.138] [debug] hyprland language update with short name us
[2024-07-30 19:50:01.138] [debug] hyprland language update with short description en
[2024-07-30 19:50:01.138] [debug] hyprland language update with variant altgr-intl
[2024-07-30 19:50:01.138] [debug] hyprland language formatted layout name us

As additional info, I swear I remember this working correctly before and breaking like maybe a month ago. I didn't get to bisecting this yet but I might do so in some time.

mexanoz avatar Jul 30 '24 14:07 mexanoz

I have the exact same problem. It's also when I switch to the "English (intl., with AltGr dead keys)" that the waybar language module shows nothing and when I reload the waybar configuration or restart waybar it's showing the language layout code again. I noticed this only today after I did a system update yesterday.

rom4kov avatar Aug 04 '24 00:08 rom4kov

I have this issue too with Hungarian (QWERTY, 102-key, dot, dead keys) smh

FlyinPancake avatar Aug 18 '24 01:08 FlyinPancake

Hi, same issue here

[2024-09-02 09:44:46.796] [debug] hyprland IPC received activelayout>>keychron-k2,English (intl., with AltGr dead keys)
[2024-09-02 09:44:46.803] [debug] hyprland language didn't find matching layout
[2024-09-02 09:44:46.803] [debug] hyprland language onevent with  with AltGr dead keys)
[2024-09-02 09:44:46.803] [debug] hyprland language update with full name 
[2024-09-02 09:44:46.803] [debug] hyprland language update with short name 
[2024-09-02 09:44:46.803] [debug] hyprland language update with short description 
[2024-09-02 09:44:46.803] [debug] hyprland language update with variant 
[2024-09-02 09:44:46.803] [debug] hyprland language formatted layout name US

It only happens when I switch keyboard layouts

szaffarano avatar Sep 02 '24 07:09 szaffarano

I created a pull request to solve this issue: https://github.com/Alexays/Waybar/pull/3700

rom4kov avatar Oct 20 '24 15:10 rom4kov

Just saw https://github.com/Alexays/Waybar/pull/3406 which offers a more complex solution of this issue that also addresses new problems that would have been introduced by my PR. My bad for not checking first.

rom4kov avatar Oct 20 '24 15:10 rom4kov

Hello, it seems the issue isn't solved yet, as i'm getting the same errors with the Lithuanian keyboard on Hyprland.

[2025-07-07 17:29:02.265] [warning] Failed to parse IPC message: activelayout>>texas-instruments-msp430-usb-example-1,Lithuanian, reason: basic_string::_M_create

370rokas avatar Jul 07 '25 14:07 370rokas

@370rokas What version are you running? Your error looks like #4229 which was fixed by #4242, but the fix is sadly not yet in a release version (the latest is 0.13.0 as of now). To fix you can build from master (waybar-git from AUR if on Arch-based) or downgrade to 0.12.0 temporarily, but that one doesn't have the fix for layouts with commas.

mexanoz avatar Jul 08 '25 17:07 mexanoz

This issue itself is fixed by #4068

mexanoz avatar Jul 08 '25 17:07 mexanoz

@370rokas What version are you running? Your error looks like #4229 which was fixed by #4242, but the fix is sadly not yet in a release version (the latest is 0.13.0 as of now). To fix you can build from master (waybar-git from AUR if on Arch-based) or downgrade to 0.12.0 temporarily, but that one doesn't have the fix for layouts with commas.

Running 0.13.0 on Fedora. Going to wait for the update. Thanks for the fast response!

370rokas avatar Jul 08 '25 17:07 370rokas