Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit a76ca76

Browse files
committed
Only expand/collapse the left pane of the focused window.
1 parent 3b7285b commit a76ca76

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

apps/client/src/widgets/buttons/left_pane_toggle.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import { t } from "../../services/i18n.js";
55
import type { EventData } from "../../components/app_context.js";
66

77
export default class LeftPaneToggleWidget extends CommandButtonWidget {
8+
private currentLeftPaneVisible: boolean;
89

910
constructor(isHorizontalLayout: boolean) {
1011
super();
1112

13+
this.currentLeftPaneVisible = options.is("leftPaneVisible");
14+
1215
this.class(isHorizontalLayout ? "toggle-button" : "launcher-button");
1316

1417
this.settings.icon = () => {
@@ -21,21 +24,23 @@ export default class LeftPaneToggleWidget extends CommandButtonWidget {
2124

2225
this.settings.title = () => (options.is("leftPaneVisible") ? t("left_pane_toggle.hide_panel") : t("left_pane_toggle.show_panel"));
2326

24-
this.settings.command = () => (options.is("leftPaneVisible") ? "hideLeftPane" : "showLeftPane");
27+
this.settings.command = () => (this.currentLeftPaneVisible ? "hideLeftPane" : "showLeftPane");
2528

2629
if (isHorizontalLayout) {
2730
this.settings.titlePlacement = "bottom";
2831
}
2932
}
3033

3134
refreshIcon() {
32-
super.refreshIcon();
33-
34-
splitService.setupLeftPaneResizer(options.is("leftPaneVisible"));
35+
if (document.hasFocus() || this.currentLeftPaneVisible === true) {
36+
super.refreshIcon();
37+
splitService.setupLeftPaneResizer(this.currentLeftPaneVisible);
38+
}
3539
}
3640

3741
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
38-
if (loadResults.isOptionReloaded("leftPaneVisible")) {
42+
if (loadResults.isOptionReloaded("leftPaneVisible") && document.hasFocus()) {
43+
this.currentLeftPaneVisible = options.is("leftPaneVisible");
3944
this.refreshIcon();
4045
}
4146
}

apps/client/src/widgets/containers/left_pane_container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class LeftPaneContainer extends FlexContainer<Component> {
1717
}
1818

1919
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
20-
if (loadResults.isOptionReloaded("leftPaneVisible")) {
20+
if (loadResults.isOptionReloaded("leftPaneVisible") && document.hasFocus()) {
2121
const visible = this.isEnabled();
2222
this.toggleInt(visible);
2323

0 commit comments

Comments
 (0)