OSD: Set LockKey connection to null if OSD for it is disabled.

This commit is contained in:
Ly-sec
2025-12-03 20:11:04 +01:00
parent 6f2bc805af
commit 74e2d1b2dc
+11 -1
View File
@@ -45,6 +45,15 @@ Variants {
readonly property bool isInputMuted: AudioService.inputMuted
readonly property real epsilon: 0.005
// LockKey OSD enabled state (reactive to settings)
readonly property bool lockKeyOSDEnabled: {
const enabledTypes = Settings.data.osd.enabledTypes || [];
// If enabledTypes is empty, all types are enabled (backwards compatibility)
if (enabledTypes.length === 0)
return true;
return enabledTypes.includes(OSD.Type.LockKey);
}
// Helper Functions
function getIcon() {
switch (currentOSDType) {
@@ -267,8 +276,9 @@ Variants {
}
// LockKeys monitoring with a cleaner approach
// Only connect when LockKey OSD is enabled to avoid starting the service unnecessarily
Connections {
target: LockKeysService
target: root.lockKeyOSDEnabled ? LockKeysService : null
function onCapsLockChanged(active) {
root.lastLockKeyChanged = active ? "CAPS ON" : "CAPS OFF";