when the window gets focus, if our mainview is session (and no modals are open), refocus either the cmdinput or the cmd (#562)

This commit is contained in:
Mike Sawka 2024-04-09 11:48:34 -07:00 committed by GitHub
parent 6919dbfb5f
commit 73e5515e17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -24,6 +24,10 @@ class ModalsModel {
})();
callback && callback();
}
hasOpenModals(): boolean {
return this.store.length > 0;
}
}
export { ModalsModel };

View File

@ -203,6 +203,7 @@ class Model {
getApi().onNativeThemeUpdated(this.onNativeThemeUpdated.bind(this));
document.addEventListener("keydown", this.docKeyDownHandler.bind(this));
document.addEventListener("selectionchange", this.docSelectionChangeHandler.bind(this));
window.addEventListener("focus", this.windowFocus.bind(this));
setTimeout(() => this.getClientDataLoop(1), 10);
this.lineHeightEnv = {
// defaults
@ -229,6 +230,12 @@ class Model {
});
}
windowFocus(): void {
if (this.activeMainView.get() == "session" && !this.modalsModel.hasOpenModals()) {
this.refocus();
}
}
fetchTerminalThemes() {
const url = new URL(this.getBaseHostPort() + "/config/terminal-themes");
fetch(url, { method: "get", body: null, headers: this.getFetchHeaders() })