1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -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 id: root
property bool compactMode: SettingsData.keyboardLayoutNameCompactMode property bool compactMode: SettingsData.keyboardLayoutNameCompactMode
property string currentLayout: "" property string currentLayout: CompositorService.isNiri ? NiriService.getCurrentKeyboardLayoutName() : ""
property string hyprlandKeyboard: "" property string hyprlandKeyboard: ""
content: Component { content: Component {
@@ -83,24 +83,14 @@ BasePill {
} }
} }
Timer { Component.onCompleted: {
id: updateTimer if (CompositorService.isHyprland) {
interval: 1000
running: true
repeat: true
onTriggered: {
updateLayout() updateLayout()
} }
} }
Component.onCompleted: {
updateLayout()
}
function updateLayout() { function updateLayout() {
if (CompositorService.isNiri) { if (CompositorService.isHyprland) {
root.currentLayout = NiriService.getCurrentKeyboardLayoutName()
} else if (CompositorService.isHyprland) {
Proc.runCommand(null, ["hyprctl", "-j", "devices"], (output, exitCode) => { Proc.runCommand(null, ["hyprctl", "-j", "devices"], (output, exitCode) => {
if (exitCode !== 0) { if (exitCode !== 0) {
root.currentLayout = "Unknown" root.currentLayout = "Unknown"