Skip to content

applets/brightness: sync night light inhibition state

Integrate inhibition properties into the monitor class so it becomes a night light control class, which also simplifies the back-of-the-frontend code.

Then use a static self member for the night light inhibitor from the control class, so that the inhibition state data (state, pending inhibits and cookie) can be shared among the applet instances.

Monitor the inhibited property to also pick up inhibitions created from outside the applet.

However we can only release night light inhibitions that we ourselves (i.e. the applet) created as we need to pass a matching cookie; this is a restriction of the DBus API. If we attempt to release an inhibition not created by ourselves (e.g. by the keyboard shortcut) by passing a wrong cookie it will fail, so make the inhibition switch unchecked but disabled in that case.

BUG: 438291

Edited by Natalie Clarius

Merge request reports