[MM-36456] Add support for Gnome's do-not-disturb (#2278)

* Add support for gnome do-not-disturb mode

* Add tests

* Invert condition
This commit is contained in:
Tasos Boulis
2022-10-17 16:37:42 +03:00
committed by GitHub
parent d5cf3e76e1
commit cf647ce3e9
4 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {execSync} from 'child_process';
import log from 'electron-log';
const GNOME_READ_DND = 'gsettings get org.gnome.desktop.notifications show-banners';
function getLinuxDoNotDisturb() {
try {
const showNotifications = execSync(GNOME_READ_DND).toString().replace('\n', '');
log.debug('getLinuxDoNotDisturb', {showNotifications});
return showNotifications !== 'true';
} catch (error) {
log.error('getLinuxDoNotDisturb Error:', {error});
return false;
}
}
export default getLinuxDoNotDisturb;