From faeda202f7a446f175923c679e3aefeda800d273 Mon Sep 17 00:00:00 2001 From: Jan Hovancik Date: Sun, 22 Dec 2024 19:55:12 +0100 Subject: [PATCH] Downcase to be sure + Cinnamon --- app/utils/dndManager.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/utils/dndManager.js b/app/utils/dndManager.js index 1293711f..2bad960c 100644 --- a/app/utils/dndManager.js +++ b/app/utils/dndManager.js @@ -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') @@ -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') @@ -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') @@ -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.`)