Skip to content

Commit

Permalink
Trigger update on battery state change
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed Jan 11, 2024
1 parent c73b397 commit ed4d2d0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/fah/client/OS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,16 @@ void OS::update() {
app.triggerUpdate();
}

auto &pm = PowerManagement::instance();
paused = app.getPaused();
active = app.isActive();
failure = app.hasFailure();
onBattery = pm.onBattery();
paused = app.getPaused();
active = app.isActive();
failure = app.hasFailure();

auto &pm = PowerManagement::instance();
bool onBattery = pm.onBattery();
if (this->onBattery != onBattery) {
this->onBattery = onBattery;
app.triggerUpdate();
}

// Keep system awake if not on battery
if (!onBattery && app.keepAwake()) lastKeepAwake = Time::now();
Expand Down

0 comments on commit ed4d2d0

Please sign in to comment.