Added a CLI command to update layout. (#521)
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user