void MuteControl::NotifyLidClosed(bool active)
{
- WMLog::GetInstance().LogInfo(L"Mute Event: Lid Close {}",
- active ? L"start" : L"stop");
- NotifyRestoreCondition(MuteTypeLidClose, active);
+ if (lidWasOpenedOnce_ || !active) {
+ WMLog::GetInstance().LogInfo(L"Mute Event: Lid Close {}",
+ active ? L"start" : L"stop");
+ NotifyRestoreCondition(MuteTypeLidClose, active);
+ lidWasOpenedOnce_ = true;
+ }
}
void MuteControl::NotifyBluetoothConnected(bool connected)
// We skip the first "was on" message
bool displayWasOffOnce_ = false;
+ // The lid-switch registration also reports the current state
+ // immediately. Ignore "closed" until the lid was open once, so a
+ // laptop started docked with its lid closed is not muted on launch.
+ bool lidWasOpenedOnce_ = false;
+
const TrayIcon* trayIcon_ = nullptr;
void NotifyRestoreCondition(MuteType type, bool active,
if (state == 0x0) { // Lid closed
muteCtrl_.NotifyLidClosed(true);
} else if (state == 0x1) { // Lid open
- muteCtrl_.NotifyLidClosed(true);
+ muteCtrl_.NotifyLidClosed(false);
}
}
}