From 8a727a080e6917011211fb8616144be44763982a Mon Sep 17 00:00:00 2001 From: Jas Singh Date: Fri, 4 Oct 2024 21:10:08 -0700 Subject: [PATCH] Added a cli method to check the visibility of a window. (#301) --- globals.d.ts | 1 + globals/utilities.ts | 8 ++++++++ main.ts | 1 + 3 files changed, 10 insertions(+) create mode 100644 globals/utilities.ts diff --git a/globals.d.ts b/globals.d.ts index bc426d4..ef10cde 100644 --- a/globals.d.ts +++ b/globals.d.ts @@ -6,6 +6,7 @@ import { Options, Variable as VariableType } from 'types/variable'; declare global { var globalMousePos: VariableType; var useTheme: (filePath: string) => void; + var isWindowVisible: (windowName: string) => boolean; var globalWeatherVar: VariableType; var options: Options; var removingNotifications: VariableType; diff --git a/globals/utilities.ts b/globals/utilities.ts new file mode 100644 index 0000000..438c666 --- /dev/null +++ b/globals/utilities.ts @@ -0,0 +1,8 @@ +globalThis.isWindowVisible = (windowName: string): boolean => { + const appWindow = App.getWindow(windowName); + + if (appWindow === undefined) { + return false; + } + return appWindow.visible; +}; diff --git a/main.ts b/main.ts index 6f995a6..c531445 100644 --- a/main.ts +++ b/main.ts @@ -1,6 +1,7 @@ import 'lib/session'; import 'scss/style'; import 'globals/useTheme'; +import 'globals/utilities'; import 'globals/mousePos'; import { Bar } from 'modules/bar/Bar';