[Notifications] Report effective Inhibited state on DBus
ClosedPublic

Authored by broulik on Tue, Oct 8, 8:46 AM.

Details

Summary

The inhibition handling (e.g. combining time-based, screen mirrored, etc) is done inside the applet.
The Server knows nothing about it and only reports Inhibited as true when an external application requested one, not when the user enabled it in the applet.
This patch exposes the NotificationManager.Server as singleton QML type and adds a way for the applet to tell it the effective inhibition state.
Exposing the server to QML could also be used in the future to provide better error reporting to the user when the service isn't running and/or owned by someone else (e.g. Dunst)

Test Plan

Would be lovely to get that into 5.17 still
@dfaure asked how apps can check do not disturb mode, turns out it was a bit broken

  • Requested external inhibition, applet went into dnd mode, checked dbus to see that change signal was emitted and property returned true
  • Killed external app, applet went normal, checked dbus to see that change signal was emitted and property returned false
  • Chose "1 hour" in applet, checked dbus to see that change signal was emitted and property
  • Started external app, nothing changed because there was already an inhibition
  • Unchecked dnd checkbox (which will force dnd off no matter what), checked dbus to see that change signal was emitted and property returned false

(didn't we have a way to put unit tests into plasmoids? would be nice to test this stuff a bit better)

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Tue, Oct 8, 8:46 AM
Restricted Application added a project: Plasma. · View Herald TranscriptTue, Oct 8, 8:46 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Tue, Oct 8, 8:46 AM
davidedmundson added inline comments.
libnotificationmanager/server.h
49

Having a property which doesn't read what you last wrote leads to very confusing QML. Sure you can make it work, but it won't be declarative.

What Server::Private has internally with the 3 inhibtedLocally, inhibitedExternally, and then the read-only effectiveInhibited value is a really neat and tidy design.

Can't we map that directly to the public API and properties here?

broulik planned changes to this revision.Wed, Oct 9, 7:20 AM

Right. Given it's the applet's responsibility to enforce the inhibition, makes sense it is the only and direct governor of that property.

broulik updated this revision to Diff 67525.Wed, Oct 9, 7:36 AM
  • Let applet write inhibited directly with no side-effects
davidedmundson accepted this revision.Wed, Oct 9, 8:38 AM
This revision is now accepted and ready to land.Wed, Oct 9, 8:38 AM
This revision was automatically updated to reflect the committed changes.