Add sound effect for notifications in Linux

This commit is contained in:
Evan Hahn
2020-09-11 16:23:11 -05:00
committed by Josh Perez
parent 6d2e994f9f
commit de66486e41
7 changed files with 146 additions and 234 deletions

View File

@@ -2,8 +2,23 @@ import * as OS from '../OS';
const MIN_WINDOWS_VERSION = '8.0.0';
export const isAudioNotificationSupported = () =>
OS.isWindows(MIN_WINDOWS_VERSION) || OS.isMacOS();
export enum AudioNotificationSupport {
None,
Native,
Custom,
}
export function getAudioNotificationSupport(): AudioNotificationSupport {
if (OS.isWindows(MIN_WINDOWS_VERSION) || OS.isMacOS()) {
return AudioNotificationSupport.Native;
} else if (OS.isLinux()) {
return AudioNotificationSupport.Custom;
}
return AudioNotificationSupport.None;
}
export const isAudioNotificationSupported = (): boolean =>
getAudioNotificationSupport() !== AudioNotificationSupport.None;
// Using `Notification::tag` has a bug on Windows 7:
// https://github.com/electron/electron/issues/11189