Skip to content

Commit

Permalink
Downcase to be sure + Cinnamon
Browse files Browse the repository at this point in the history
  • Loading branch information
hovancik committed Dec 22, 2024
1 parent 4ecd7fe commit faeda20
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/utils/dndManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class DndManager extends EventEmitter {
}

async _isDndEnabledLinux () {
const de = process.env.XDG_CURRENT_DESKTOP
const de = process.env.XDG_CURRENT_DESKTOP.toLowerCase()
// https://specifications.freedesktop.org/mime-apps-spec/latest/file.html
// https://specifications.freedesktop.org/menu-spec/latest/onlyshowin-registry.html

switch (true) {
case de.includes('KDE'):
case de.includes('kde'):
try {
const obj = await this.bus.getProxyObject('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
const properties = obj.getInterface('org.freedesktop.DBus.Properties')
Expand All @@ -59,7 +59,7 @@ class DndManager extends EventEmitter {
}
} catch (e) {}
break
case de.includes('XFCE'):
case de.includes('xfce'):
try {
const obj = await this.bus.getProxyObject('org.xfce.Xfconf', '/org/xfce/Xfconf')
const properties = obj.getInterface('org.xfce.Xfconf')
Expand All @@ -69,7 +69,7 @@ class DndManager extends EventEmitter {
}
} catch (e) {}
break
case de.includes('GNOME'):
case de.includes('gnome'):
try {
const exec = this.util.promisify(require('node:child_process').exec)
const { stdout } = await exec('gsettings get org.gnome.desktop.notifications show-banners')
Expand All @@ -78,6 +78,15 @@ class DndManager extends EventEmitter {
}
} catch (e) {}
break
case de.includes('cinnamon'):
try {
const exec = this.util.promisify(require('node:child_process').exec)
const { stdout } = await exec('gsettings get org.cinnamon.desktop.notifications display-notifications')
if (stdout.replace(/[^0-9a-zA-Z]/g, '') === 'false') {
return true
}
} catch (e) {}
break
default:
if (!this._unsupDEErrorShown) {
log.info(`Stretchly: ${process.env.XDG_CURRENT_DESKTOP} not supported for DND detection, yet.`)
Expand Down

0 comments on commit faeda20

Please sign in to comment.