You are not logged in.
Pages: 1
Hi there,
for my open-source app, I am trying to detect when my users are in DND to not disturb them. I have this working for KDE and trying to do for XFCE now.
I am in node, so using some dbus library, and would like to do the same for XFCE. I was not able to find where to look for XFCE value so I asked AIs, but no seems to work.
try {
const obj = await bus.getProxyObject('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
const properties = obj.getInterface('org.freedesktop.DBus.Properties')
const dndEnabled = await properties.Get('org.freedesktop.Notifications', 'Inhibited')
if (await dndEnabled.value) {
return true
}
} catch (e) {
// KDE is not running
}
try {
const obj = await bus.getProxyObject('org.xfce.settings.DoNotDisturb', '/org/xfce/settings/DoNotDisturb')
const properties = obj.getInterface('org.freedesktop.DBus.Properties')
const dndEnabled = await properties.Get('org.xfce.settings.DoNotDisturb', 'Enabled')
if (await dndEnabled.value) {
return true
}
} catch (e) {
// XFCE is not running
}
Any ideas welcome
Last edited by conta (2023-10-27 06:29:14)
Offline
Hello and welcome.
Xfce uses xfconf to manage settings, so you could use the Xfconf interface on the session bus to query the value of "/do-not-disturb" in the "xfce4-notifyd" channel. Here is what d-feet says about the method:
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Many thanks!
Here's the updated code that works:
try {
const obj = await bus.getProxyObject('org.xfce.Xfconf', '/org/xfce/Xfconf')
const properties = obj.getInterface('org.xfce.Xfconf')
const dndEnabled = await properties.GetProperty('xfce4-notifyd', '/do-not-disturb')
if (await dndEnabled.value) {
return true
}
} catch (e) {
// XFCE is not running
}
Offline
Pages: 1
[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 520.63 KiB (Peak: 521.48 KiB) ]