Provision for when there is DBUS on the system but notifications are not configured

master
Zlatin Balevsky 2024-07-28 21:02:24 +03:00
parent 651c9f3e94
commit 141c70d26d
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import org.freedesktop.dbus.connections.impl.DBusConnection
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
import org.freedesktop.dbus.errors.NoReply
import org.freedesktop.dbus.exceptions.DBusException
import org.freedesktop.dbus.errors.ServiceUnknown
import org.freedesktop.dbus.interfaces.DBusInterface
import org.freedesktop.dbus.types.UInt32
import org.freedesktop.dbus.types.UInt64
@ -25,7 +26,7 @@ class DBUSNotifyService {
notifications = DBusConnectionBuilder.forSessionBus().build().
getRemoteObject(BUS_NAME, BUS_PATH, Notifications.class)
sound = notifications.GetCapabilities().contains("sound")
} catch (DBusException | NoReply bad) {
} catch (DBusException | NoReply | ServiceUnknown bad) {
sound = false
}
NOTIFICATIONS = notifications