systemwide

systemwide — API to handle system-wide notifications

Synopsis

#include <tinynotify-systemwide.h>

extern const NotifyError NOTIFY_ERROR_SYSCALL_FAILED;
extern const NotifyError NOTIFY_ERROR_UIDS_COMPROMISED;
extern const NotifyError NOTIFY_ERROR_NO_BUS_FOUND;
int                 notification_send_systemwide        (Notification notification,
                                                         NotifySession session);

Description

The libtinynotify-systemwide helper library provides the routines to send notifications system-wide, i.e. on all D-Bus session buses in the system.

Using it as basically as simple as adding the necessary include, and replacing notification_send() in the code with notification_send_systemwide().

Although libtinynotify-cli links with the actual libtinynotify itself, and uses its header, one should refer to the libtinynotify pkg-config package explicitly and include its header anyway.

Details

NOTIFY_ERROR_SYSCALL_FAILED

extern const NotifyError NOTIFY_ERROR_SYSCALL_FAILED;

notification_send_systemwide* An error raised when one of the syscalls required for the operation fails.


NOTIFY_ERROR_UIDS_COMPROMISED

extern const NotifyError NOTIFY_ERROR_UIDS_COMPROMISED;

An error raised when setresuid() fails to restore the original caller UID.

This means that the application has lost its original UID and should terminate ASAP.


NOTIFY_ERROR_NO_BUS_FOUND

extern const NotifyError NOTIFY_ERROR_NO_BUS_FOUND;

An error returned by notification_send_systemwide() when it was unable to find a single D-Bus session bus in procfs.

Please note that this as well covers a case when the session bus is not visible to user in procfs due to limited privileges.


notification_send_systemwide ()

int                 notification_send_systemwide        (Notification notification,
                                                         NotifySession session);

Send a notification to all notification daemons found (in procfs).

Todo: support formatstring args.

notification :

the notification to send

session :

session to send the notification through

Returns :

number of notifications actually sent or 0 if no daemon reached (one can use notify_session_get_error_message() to get more details on that)