Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.78k stars 710 forks source link

Fix parsing issue in hyprland language module with layouts containing commas #3700

Closed rom4kov closed 1 month ago

rom4kov commented 1 month ago

Problem: Since version 10.4, the hyprland language module had an issue with parsing keyboard layout names that contain commas. For example, the layout "English (intl., with AltGr dead keys)" would not be parsed correctly when switching layouts.

Issue: The IPC event string for a layout like "English (intl., with AltGr dead keys)" received in the onEvent function contains two commas—one separating the keyboard name from the layout name and another within the layout name. However, the function currently splits the string after the last comma, which leads to incorrect parsing.

Solution: This pull request modifies the onEvent function to split the event string at the first comma instead of the last one, allowing for accurate parsing of both the keyboard name and layout name.

rom4kov commented 1 month ago

Hi! I apologize for not checking the existing discussions and the recent pull request https://github.com/Alexays/Waybar/pull/3406 related to the parsing issue with keyboard layout names. I see that there are concerns about the approach I took, particularly with handling embedded commas in both the keyboard name and layout name. Just changing from splitting on the last comma to splitting on the first comma is my solution proposes would not solve the issue for user's with layouts that have commas inside the keyboard name for example. Therefore I'm closing this PR.