1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

keyboard layout: remove polling on hyprland

This commit is contained in:
bbedward
2025-10-29 16:58:07 -04:00
parent cc5b98a5d2
commit 2a7cf187ad

View File

@@ -12,7 +12,7 @@ BasePill {
id: root
property bool compactMode: SettingsData.keyboardLayoutNameCompactMode
property string currentLayout: ""
property string currentLayout: CompositorService.isNiri ? NiriService.getCurrentKeyboardLayoutName() : ""
property string hyprlandKeyboard: ""
content: Component {
@@ -83,24 +83,14 @@ BasePill {
}
}
Timer {
id: updateTimer
interval: 1000
running: true
repeat: true
onTriggered: {
Component.onCompleted: {
if (CompositorService.isHyprland) {
updateLayout()
}
}
Component.onCompleted: {
updateLayout()
}
function updateLayout() {
if (CompositorService.isNiri) {
root.currentLayout = NiriService.getCurrentKeyboardLayoutName()
} else if (CompositorService.isHyprland) {
if (CompositorService.isHyprland) {
Proc.runCommand(null, ["hyprctl", "-j", "devices"], (output, exitCode) => {
if (exitCode !== 0) {
root.currentLayout = "Unknown"