Notification API#
Name |
Specification |
Description |
---|---|---|
allNotifications |
` ARRAY OBJECT_PATH` property (read) |
List of all current applications. |
unownedNotifications |
` ARRAY OBJECT_PATH` property (read) |
List of all applications where the owning application is no longer running. |
notificationAdded |
signal
|
Signal sent when a notification has been added. |
notificationRemoved |
signal
|
Signal sent when a notification has been removed. |
notificationChanged |
signal
|
Signal sent when a notification has been modified. |
add |
method
- (in) identifier
|
Add a new
notification.
If the application
doesn’t have
permission to add
the notification, or
it fails to be added
it will return
|
take |
method
|
Take ownership of a notification. |
notifications |
method - (out) - (out) ` ARRAY OBJECT_PATH` |
List of all notifications owned by the current application. |
get |
method
|
Get the object path for a notification based on it’s identifier. |
Example Usage#
#include <liboxide/dbus.h>
using namespace codes::eeems::oxide1;
int main(int argc, char *argv[]){
Q_UNUSED(argc);
Q_UNUSED(argv);
auto bus = QDBusConnection::systemBus();
General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
qDebug() << "Requesting notification API...";
QDBusObjectPath path = api.requestAPI("notification");
if(path.path() == "/"){
qDebug() << "Unable to get notification API";
return EXIT_FAILURE;
}
qDebug() << "Got the notification API!";
Notifications notifications(OXIDE_SERVICE, path.path(), bus);
qDebug() << "Notificaitons:" << notifications.allNotifications();
return EXIT_SUCCESS;
}
#!/bin/bash
echo -n "Notifications: "
rot notification get notifications | jq
Notification Object#
Name |
Specification |
Description |
---|---|---|
identifier |
|
Unique identifier for the notification. |
application |
|
Name of the application that owns this notification. |
text |
|
Text of the notification. |
icon |
|
Icon used for the notification. |
changed |
signal
` ARRAY{STRING VARIANT}` |
Signal sent when something on the notification has changed. The first output property contains a map of changed properties and their values. |
removed |
signal |
Signal sent when this notification has been removed. |
displayed |
signal |
Signal sent when this notification has been displayed. |
clicked |
signal |
Signal sent when this notification has been clicked. |
display |
method |
Display the notification to the user. This will interrupt what the user is doing to display the text on the bottom left corner. |
remove |
method |
Remove the notification. |
click |
method |
Emit the |
Example Usage#
#include <QUuid>
#include <liboxide/dbus.h>
using namespace codes::eeems::oxide1;
int main(int argc, char *argv[]){
Q_UNUSED(argc);
Q_UNUSED(argv);
auto bus = QDBusConnection::systemBus();
General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
qDebug() << "Requesting notification API...";
QDBusObjectPath path = api.requestAPI("notification");
if(path.path() == "/"){
qDebug() << "Unable to get notification API";
return EXIT_FAILURE;
}
qDebug() << "Got the notification API!";
Notifications notifications(OXIDE_SERVICE, path.path(), bus);
auto guid = QUuid::createUuid().toString();
qDebug() << "Adding notification" << guid;
path = notifications.add(guid, "codes.eeems.fret", "Hello world!", "");
if(path.path() == "/"){
qDebug() << "Failed to add notification";
return EXIT_FAILURE;
}
Notification notification(OXIDE_SERVICE, path.path(), bus);
qDebug() << "Displaying notification" << guid;
notification.display().waitForFinished();
notification.remove();
return EXIT_SUCCESS;
}
#!/bin/bash
uuid=$(cat /proc/sys/kernel/random/uuid)
path=$(rot notification call add \
"QString:\"$uuid\"" \
'QString:"sample-application"' \
'QString:"Hello world!"' \
'QString:""' \
| jq -cr \
| sed 's|/codes/eeems/oxide1/||'
)
echo "Displaying notification $uuid"
rot --object Notification:$path notification call display
rot --object Notification:$path notification call remove