signal-desktop/ts/OS.ts

23 lines
680 B
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2018 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
2018-05-02 23:57:02 +00:00
import is from '@sindresorhus/is';
import os from 'os';
import semver from 'semver';
2020-09-11 19:37:01 +00:00
export const isMacOS = (): boolean => process.platform === 'darwin';
export const isLinux = (): boolean => process.platform === 'linux';
export const isWindows = (minVersion?: string): boolean => {
2018-05-02 23:57:02 +00:00
const osRelease = os.release();
2018-05-23 23:04:39 +00:00
if (process.platform !== 'win32') {
return false;
}
return is.undefined(minVersion) ? true : semver.gte(osRelease, minVersion);
2018-05-02 23:57:02 +00:00
};
2022-07-05 16:44:53 +00:00
// Windows 10 and above
export const hasCustomTitleBar = (): boolean =>
isWindows('10.0.0') || Boolean(process.env.CUSTOM_TITLEBAR);