From 7505e2c3f3cc92bdbc1ef3a2650a2c32170f8b9e Mon Sep 17 00:00:00 2001 From: mexanoz Date: Fri, 27 Jun 2025 20:54:38 +0500 Subject: [PATCH] fix hyprland/language layout parsing --- src/modules/hyprland/language.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/hyprland/language.cpp b/src/modules/hyprland/language.cpp index 2989926a..3f141bbd 100644 --- a/src/modules/hyprland/language.cpp +++ b/src/modules/hyprland/language.cpp @@ -70,8 +70,14 @@ void Language::onEvent(const std::string& ev) { // Last comma before variants parenthesis, eg: // activelayout>>micro-star-int'l-co.,-ltd.-msi-gk50-elite-gaming-keyboard,English (US, intl., // with dead keys) - std::string beforParenthesis(begin(ev), begin(ev) + ev.find_last_of('(')); - auto layoutName = ev.substr(beforParenthesis.find_last_of(',') + 1); + std::string beforeParenthesis; + auto parenthesisPos = ev.find_last_of('('); + if (parenthesisPos == std::string::npos) { + beforeParenthesis = ev; + } else { + beforeParenthesis = std::string(begin(ev), begin(ev) + parenthesisPos); + } + auto layoutName = ev.substr(beforeParenthesis.find_last_of(',') + 1); if (config_.isMember("keyboard-name") && kbName != config_["keyboard-name"].asString()) return; // ignore