Added a CLI command to update layout. (#521)

This commit is contained in:
Jas Singh
2024-11-17 12:37:38 -08:00
committed by GitHub
parent ac794dccb0
commit ef761f2dcf
2 changed files with 17 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
import options from 'options';
globalThis.isWindowVisible = (windowName: string): boolean => {
const appWindow = App.getWindow(windowName);
@@ -6,3 +8,17 @@ globalThis.isWindowVisible = (windowName: string): boolean => {
}
return appWindow.visible;
};
globalThis.setLayout = (layout: string): string => {
console.log(layout);
try {
const layoutJson = JSON.parse(layout);
const { layouts } = options.bar;
layouts.value = layoutJson;
return 'Successfully updated layout.';
} catch (error) {
return `Failed to set layout: ${error}`;
}
};