Skip to content

Commit

Permalink
Add Nightstand mode Always-on-Display handling
Browse files Browse the repository at this point in the history
This adds handling for independent main screen and Nightstand mode
Always-on-display settings.  This addresses AsteroidOS/asteroid#131

Signed-off-by: Ed Beroset <beroset@ieee.org>
  • Loading branch information
beroset authored and MagneFire committed Sep 12, 2023
1 parent 2a1dc87 commit a2dbfe4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/qml/MainScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ Item {
defaultValue: AsteroidUtils.DeviceInfo.needsBurnInProtection
}

ConfigurationValue {
id: alwaysOnDisplay
key: "/org/asteroidos/settings/always-on-display"
defaultValue: true
}

Item {
id: burnInProtectionManager

Expand Down Expand Up @@ -255,6 +261,12 @@ Item {
ConfigurationValue {
id: nightstandEnabled
key: "/desktop/asteroid/nightstand/enabled"
defaultValue: true
}

ConfigurationValue {
id: nightstandAlwaysOnDisplay
key: "/desktop/asteroid/nightstand/always-on-display"
defaultValue: false
}

Expand All @@ -278,6 +290,7 @@ Item {
// enter nightstand mode
oldBrightness = displaySettings.brightness
displaySettings.brightness = nightstandBrightness.value
displaySettings.lowPowerModeEnabled = nightstandAlwaysOnDisplay.value
}
} else {
if (nightstandEnabled.value) {
Expand All @@ -288,6 +301,7 @@ Item {
// exit nightstand mode immediately
nightstandDelayTimer.stop()
displaySettings.brightness = oldBrightness
displaySettings.lowPowerModeEnabled = alwaysOnDisplay.value
}
}
}
Expand All @@ -298,6 +312,7 @@ Item {
onTriggered: {
// timer expired, so restore brightness
displaySettings.brightness = nightstandMode.oldBrightness
displaySettings.lowPowerModeEnabled = alwaysOnDisplay.value
}
}
}
Expand Down

0 comments on commit a2dbfe4

Please sign in to comment.