From 4c6cf8d21b70ca8c8d949ac164b2e03269957639 Mon Sep 17 00:00:00 2001 From: loner <2788892716@qq.com> Date: Tue, 25 Nov 2025 20:32:04 +0800 Subject: [PATCH] feat: Add setting to disable lock key OSD notifications --- Assets/Translations/en.json | 4 ++++ Assets/settings-default.json | 3 ++- Commons/Settings.qml | 1 + Modules/OSD/OSD.qml | 6 ++++++ Modules/Panels/Settings/Tabs/OsdTab.qml | 7 +++++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 76a3eb25..37c6fe45 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -1675,6 +1675,10 @@ "label": "General" } }, + "show-lock-key-notifications": { + "description": "Show notifications when Caps Lock, Num Lock, or Scroll Lock keys are toggled.", + "label": "Show lock key notifications" + }, "title": "On-Screen Display" }, "screen-recorder": { diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 377db5d3..44b129f4 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -284,7 +284,8 @@ "monitors": [], "autoHideMs": 2000, "overlayLayer": true, - "backgroundOpacity": 1 + "backgroundOpacity": 1, + "showLockKeyNotifications": true }, "audio": { "volumeStep": 5, diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 940837df..9d793d55 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -460,6 +460,7 @@ Singleton { property int autoHideMs: 2000 property bool overlayLayer: true property real backgroundOpacity: 1.0 + property bool showLockKeyNotifications: true } // audio diff --git a/Modules/OSD/OSD.qml b/Modules/OSD/OSD.qml index e2949b4d..b8a1f135 100644 --- a/Modules/OSD/OSD.qml +++ b/Modules/OSD/OSD.qml @@ -205,6 +205,8 @@ Variants { target: LockKeysService function onCapsLockChanged(active) { + if (!Settings.data.osd.showLockKeyNotifications) + return; root.currentOSDType = "lockkey"; root.lastLockKeyChanged = active ? "CAPS ON" : "CAPS OFF"; if (!root.active) @@ -214,6 +216,8 @@ Variants { } function onNumLockChanged(active) { + if (!Settings.data.osd.showLockKeyNotifications) + return; root.currentOSDType = "lockkey"; root.lastLockKeyChanged = active ? "NUM ON" : "NUM OFF"; if (!root.active) @@ -223,6 +227,8 @@ Variants { } function onScrollLockChanged(active) { + if (!Settings.data.osd.showLockKeyNotifications) + return; root.currentOSDType = "lockkey"; root.lastLockKeyChanged = active ? "SCROLL ON" : "SCROLL OFF"; if (!root.active) diff --git a/Modules/Panels/Settings/Tabs/OsdTab.qml b/Modules/Panels/Settings/Tabs/OsdTab.qml index 9a6377df..7c218d2b 100644 --- a/Modules/Panels/Settings/Tabs/OsdTab.qml +++ b/Modules/Panels/Settings/Tabs/OsdTab.qml @@ -99,6 +99,13 @@ ColumnLayout { onToggled: checked => Settings.data.osd.overlayLayer = checked } + NToggle { + label: I18n.tr("settings.osd.show-lock-key-notifications.label", "Show lock key notifications") + description: I18n.tr("settings.osd.show-lock-key-notifications.description", "Show notifications when Caps Lock, Num Lock, or Scroll Lock keys are toggled.") + checked: Settings.data.osd.showLockKeyNotifications + onToggled: checked => Settings.data.osd.showLockKeyNotifications = checked + } + NLabel { label: I18n.tr("settings.osd.background-opacity.label", "Background opacity") description: I18n.tr("settings.osd.background-opacity.description", "Controls the transparency of the OSD background.")