Merge branch 'main' of github.com:noctalia-dev/noctalia-shell
This commit is contained in:
commit
ffb972f7c6
2 changed files with 13 additions and 3 deletions
|
|
@ -68,14 +68,20 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: UPower.displayDevice
|
target: UPower.displayDevice
|
||||||
function onPercentageChanged() {
|
function onPercentageChanged() {
|
||||||
root.maybeNotify(percent, charging)
|
var currentPercent = UPower.displayDevice.percentage * 100
|
||||||
|
var isCharging = UPower.displayDevice.state === UPowerDeviceState.Charging
|
||||||
|
root.maybeNotify(currentPercent, isCharging)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStateChanged() {
|
function onStateChanged() {
|
||||||
|
var isCharging = UPower.displayDevice.state === UPowerDeviceState.Charging
|
||||||
// Reset notification flag when charging starts
|
// Reset notification flag when charging starts
|
||||||
if (charging) {
|
if (isCharging) {
|
||||||
root.hasNotifiedLowBattery = false
|
root.hasNotifiedLowBattery = false
|
||||||
}
|
}
|
||||||
|
// Also re-evaluate maybeNotify, as state might have changed
|
||||||
|
var currentPercent = UPower.displayDevice.percentage * 100
|
||||||
|
root.maybeNotify(currentPercent, isCharging)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,11 @@ Singleton {
|
||||||
target: powerProfiles
|
target: powerProfiles
|
||||||
function onProfileChanged() {
|
function onProfileChanged() {
|
||||||
root.profile = powerProfiles.profile
|
root.profile = powerProfiles.profile
|
||||||
ToastService.showNotice("Power Profile", root.profileName())
|
// Only show toast if we have a valid profile name (not "Unknown")
|
||||||
|
const profileName = root.profileName()
|
||||||
|
if (profileName !== "Unknown") {
|
||||||
|
ToastService.showNotice("Power Profile", profileName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue