1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

keyboard layout: add consistent helper to map layout codes to display

fixes #1849
This commit is contained in:
bbedward
2026-07-04 11:57:17 -04:00
parent d766c0773c
commit 25a1b125b7
4 changed files with 117 additions and 123 deletions
+3 -10
View File
@@ -12,6 +12,7 @@ import qs.Common
import qs.Modals
import qs.Services
import qs.Widgets
import "../../Common/LayoutCodes.js" as LayoutCodes
Item {
id: root
@@ -175,8 +176,7 @@ Item {
}
hyprlandKeyboard = mainKeyboard.name;
if (mainKeyboard.active_keymap) {
const parts = mainKeyboard.active_keymap.split(" ");
hyprlandCurrentLayout = parts[0].substring(0, 2).toUpperCase();
hyprlandCurrentLayout = LayoutCodes.layoutCode(mainKeyboard.active_keymap);
} else {
hyprlandCurrentLayout = "";
}
@@ -1361,14 +1361,7 @@ Item {
StyledText {
text: {
if (CompositorService.isNiri) {
const layout = NiriService.getCurrentKeyboardLayoutName();
if (!layout)
return "";
const parts = layout.split(" ");
if (parts.length > 0) {
return parts[0].substring(0, 2).toUpperCase();
}
return layout.substring(0, 2).toUpperCase();
return LayoutCodes.layoutCode(NiriService.getCurrentKeyboardLayoutName());
} else if (CompositorService.isHyprland) {
return hyprlandCurrentLayout;
}