[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:
23
src/main/notifications/dnd-linux.ts
Normal file
23
src/main/notifications/dnd-linux.ts
Normal 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;
|
Reference in New Issue
Block a user