Suffix "Length" to the dbus variables for the number of notifications

This commit is contained in:
Moritz Luedecke 2020-12-25 15:03:50 +01:00
parent 4d74c7b46e
commit 1827f0d974
No known key found for this signature in database
GPG Key ID: 16A7C55D54A18BF9
2 changed files with 10 additions and 10 deletions

View File

@ -66,11 +66,11 @@ case "${1:-}" in
[ $# -eq 1 ] || [ "${2}" = "displayed" ] || [ "${2}" = "history" ] || [ "${2}" = "waiting" ] \
|| die "Please give either 'displayed', 'history', 'waiting' or none as count parameter."
if [ $# -eq 1 ]; then
property_get waiting | ( read -r _ _ waiting; printf " Waiting: %s\n" "${waiting}" )
property_get displayed | ( read -r _ _ displayed; printf " Currently displayed: %s\n" "${displayed}" )
property_get history | ( read -r _ _ history; printf " History: %s\n" "${history}")
property_get waitingLength | ( read -r _ _ waiting; printf " Waiting: %s\n" "${waiting}" )
property_get displayedLength | ( read -r _ _ displayed; printf " Currently displayed: %s\n" "${displayed}" )
property_get historyLength | ( read -r _ _ history; printf " History: %s\n" "${history}")
else
property_get ${2} | ( read -r _ _ notifications; printf "%s\n" "${notifications}"; )
property_get ${2}Length | ( read -r _ _ notifications; printf "%s\n" "${notifications}"; )
fi
;;
"history-pop")

View File

@ -85,9 +85,9 @@ static const char *introspection_xml =
" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
" </property>"
" <property name=\"displayed\" type=\"u\" access=\"read\" />"
" <property name=\"history\" type=\"u\" access=\"read\" />"
" <property name=\"waiting\" type=\"u\" access=\"read\" />"
" <property name=\"displayedLength\" type=\"u\" access=\"read\" />"
" <property name=\"historyLength\" type=\"u\" access=\"read\" />"
" <property name=\"waitingLength\" type=\"u\" access=\"read\" />"
" </interface>"
"</node>";
@ -601,13 +601,13 @@ GVariant *dbus_cb_dunst_Properties_Get(GDBusConnection *connection,
if (STR_EQ(property_name, "paused")) {
return g_variant_new_boolean(!status.running);
} else if (STR_EQ(property_name, "displayed")) {
} else if (STR_EQ(property_name, "displayedLength")) {
unsigned int displayed = queues_length_displayed();
return g_variant_new_uint32(displayed);
} else if (STR_EQ(property_name, "history")) {
} else if (STR_EQ(property_name, "historyLength")) {
unsigned int history = queues_length_history();
return g_variant_new_uint32(history);
} else if (STR_EQ(property_name, "waiting")) {
} else if (STR_EQ(property_name, "waitingLength")) {
unsigned int waiting = queues_length_waiting();
return g_variant_new_uint32(waiting);
} else {