Open startup terminal as a floating window
This commit is contained in:
1 parent
722e182076
commit
5d7e9857ca
2 files changed
+3
-2
No files matched your search
@@ -52,9 +52,10 @@ class WindowManager {
|
|||||||
return id in this.floatingRects;
|
return id in this.floatingRects;
|
||||||
}
|
}
|
||||||
|
|
||||||
openTerminal(startupCommand = '') {
|
openTerminal(startupCommand = '', options: { floating?: boolean } = {}) {
|
||||||
const terminal = { id: `kitty-${this.nextTerminalNumber++}`, startupCommand };
|
const terminal = { id: `kitty-${this.nextTerminalNumber++}`, startupCommand };
|
||||||
this.terminals.push(terminal);
|
this.terminals.push(terminal);
|
||||||
|
if (options.floating) this.floatingRects[terminal.id] = null;
|
||||||
this.focus(terminal.id);
|
this.focus(terminal.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
themeState.restore();
|
themeState.restore();
|
||||||
const isWideScreen = window.innerWidth >= 768;
|
const isWideScreen = window.innerWidth >= 768;
|
||||||
if (!pageOpen && isWideScreen && desktop.startupCommand) windowManager.openTerminal(desktop.startupCommand);
|
if (!pageOpen && isWideScreen && desktop.startupCommand) windowManager.openTerminal(desktop.startupCommand, { floating: true });
|
||||||
window.addEventListener('click', handleImageClick, true);
|
window.addEventListener('click', handleImageClick, true);
|
||||||
return () => window.removeEventListener('click', handleImageClick, true);
|
return () => window.removeEventListener('click', handleImageClick, true);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user