mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(lock-keys): sync bar state from sysfs on first poll after startup
This commit is contained in:
@@ -35,9 +35,6 @@ Singleton {
|
||||
signal numLockChanged(bool active)
|
||||
signal scrollLockChanged(bool active)
|
||||
|
||||
// Flag to track if this is the initial check to avoid OSD triggers
|
||||
property bool initialCheckDone: false
|
||||
|
||||
Instantiator {
|
||||
model: FolderListModel {
|
||||
id: folderModel
|
||||
@@ -52,13 +49,29 @@ Singleton {
|
||||
onTextChanged: () => {
|
||||
if (!this.isWanted)
|
||||
return;
|
||||
|
||||
var state = !this.text().startsWith("0");
|
||||
var kind = fileName.split("::")[1];
|
||||
|
||||
// First read after polling starts: sync bar/UI from sysfs without firing
|
||||
// *Changed signals (OSD listens to those and would flash on startup).
|
||||
if (!this.initialCheckDone) {
|
||||
this.initialCheckDone = true;
|
||||
switch (kind) {
|
||||
case "numlock":
|
||||
root.numLockOn = state;
|
||||
break;
|
||||
case "capslock":
|
||||
root.capsLockOn = state;
|
||||
break;
|
||||
case "scrolllock":
|
||||
root.scrollLockOn = state;
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var state = !this.text().startsWith("0");
|
||||
switch (fileName.split("::")[1]) {
|
||||
switch (kind) {
|
||||
case "numlock":
|
||||
root.numLockOn = state;
|
||||
root.numLockChanged(state);
|
||||
@@ -91,7 +104,7 @@ Singleton {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip first OSD event if one fires immediately after enabling
|
||||
// After shouldRun becomes true, first brightness read updates properties only (no *Changed signals).
|
||||
property bool initialCheckDone: false
|
||||
property variant connections: Connections {
|
||||
target: root
|
||||
|
||||
Reference in New Issue
Block a user