Skip to content

policyagent, applet: support blocking inhibitions

Natalie Clarius requested to merge work/natalie/inhibitions-block into master

Allow the user to release, and optionally configure to permanently reject, inhibitions from certain apps for certain reasons, with new buttons in the applet's inhibition hint.

Expose the following new methods and signals via D-Bus:

  • BlockInhibition: Release any current inhibitions that match the pattern. If set to permanent, also reject any new inhibitions from that app with that reason. Permanently blocked inhibitions are kept track of in a list saved in the powerdevil configuration file.
  • UnblockInhibition: Retroactively inforce matching inhibitions that were previously released or rejected but are still relevant. If set to permanent, remove the pair from the list in the config if applicable.
  • ListPermanentlyBlockedInhibitions, ListTemporarilyBlockedInhibitions: List all inhibitions that that would currently be active but were released or rejected on user request.
  • PermanentlyBlockedInhibitionsChanged, TemporarilyBlockedInhibitionsChanged: Emitted when blocked inhibitions are added or removed.

In the applet, add buttons in the inhibition hint using this new DBus interface.
image image

Also in the applet, adopt the same layout in the manual inhibition control. This makes the UI less visually busy and puts more focus on the probably more interesting app inhibitions.

Before: After:
image image
image image

For motivation of why such functionality is desired, see the bug report.

How to test:

  1. Build the branch
  2. Restart powerdevil: systemctl --user restart plasma-powerdevil.service and the Plasma applet
  3. Play a video and wait five seconds for the inhibition to appear
  4. Press the button
  5. Confirm computer automatically goes to sleep after the inactivity period set in power management settings even while video is still playing
  6. Confirm that the "every time" option will also take effect when you repeat the same steps again, and the "only this time" option will not
  7. Confirm the applet shows you a message informing about this, and that the "Block" button undoes it as expected

BUG: 423745

CC @broulik

Edited by Natalie Clarius

Merge request reports

Loading