aboutsummaryrefslogtreecommitdiffstats
path: root/src/electron/ipc-api/dnd.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/electron/ipc-api/dnd.js')
-rw-r--r--src/electron/ipc-api/dnd.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/electron/ipc-api/dnd.js b/src/electron/ipc-api/dnd.js
index da4d7781e..6fb8999a3 100644
--- a/src/electron/ipc-api/dnd.js
+++ b/src/electron/ipc-api/dnd.js
@@ -1,16 +1,23 @@
1import { ipcMain } from 'electron'; 1import { ipcMain } from 'electron';
2import { getDoNotDisturb } from '@meetfranz/electron-notification-state'; 2import { getDoNotDisturb } from 'macos-notification-state';
3import { isMac } from '../../environment';
3 4
4const debug = require('debug')('Ferdi:ipcApi:dnd'); 5const debug = require('debug')('Ferdi:ipcApi:dnd');
5 6
6export default async () => { 7export default async () => {
7 ipcMain.handle('get-dnd', async () => { 8 ipcMain.handle('get-dnd', async () => {
9 if (!isMac) {
10 debug('Not on macOS, returning', false);
11 return false;
12 }
13
8 try { 14 try {
9 const isDND = getDoNotDisturb(); 15 const isDND = getDoNotDisturb();
10 debug('Fetching DND state, set to', isDND); 16 debug('Fetching DND state, set to', isDND);
11 return isDND; 17 return isDND;
12 } catch (e) { 18 } catch (e) {
13 console.error(e); 19 console.error(e);
20 return false;
14 } 21 }
15 }); 22 });
16}; 23};