Skip to content

Commit 76845a0

Browse files
author
itsdodobitch
committed
Keep terminal sidebar visible
1 parent fdd52eb commit 76845a0

4 files changed

Lines changed: 31 additions & 4 deletions

File tree

Sources/HermesDesktop/Resources/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@
823823
"Hermes Agent recorded warning events that may need recovery." = "Hermes Agent recorded warning events that may need recovery.";
824824
"Show Workspace Sidebar" = "Show Workspace Sidebar";
825825
"Hide Workspace Sidebar" = "Hide Workspace Sidebar";
826+
"Workspace Sidebar is always visible in Terminal" = "Workspace Sidebar is always visible in Terminal";
826827
"Show Section Browser" = "Show Section Browser";
827828
"Hide Section Browser" = "Hide Section Browser";
828829
"All Connected Channels" = "All Connected Channels";

Sources/HermesDesktop/Resources/ru.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@
823823
"Hermes Agent recorded warning events that may need recovery." = "Hermes Agent recorded warning events that may need recovery.";
824824
"Show Workspace Sidebar" = "Показать боковую панель рабочей области";
825825
"Hide Workspace Sidebar" = "Скрыть боковую панель рабочей области";
826+
"Workspace Sidebar is always visible in Terminal" = "Боковая панель рабочего пространства в разделе Terminal всегда видна.";
826827
"Show Section Browser" = "Показать браузер раздела";
827828
"Hide Section Browser" = "Скрыть браузер раздела";
828829
"All Connected Channels" = "All Connected Channels";

Sources/HermesDesktop/Resources/zh-Hans.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@
823823
"Hermes Agent recorded warning events that may need recovery." = "Hermes Agent recorded warning events that may need recovery.";
824824
"Show Workspace Sidebar" = "显示工作区侧边栏";
825825
"Hide Workspace Sidebar" = "隐藏工作区侧边栏";
826+
"Workspace Sidebar is always visible in Terminal" = "在 Terminal 部分中,工作区侧边栏始终保持可见。";
826827
"Show Section Browser" = "显示分区浏览器";
827828
"Hide Section Browser" = "隐藏分区浏览器";
828829
"All Connected Channels" = "All Connected Channels";

Sources/HermesDesktop/Views/RootView.swift

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ struct RootView: View {
3737
HermesCollapseToolbarButton(
3838
systemImage: "sidebar.left",
3939
isActive: isWorkspaceSidebarCollapsed,
40-
isEnabled: true,
41-
help: isWorkspaceSidebarCollapsed
42-
? L10n.string("Show Workspace Sidebar")
43-
: L10n.string("Hide Workspace Sidebar")
40+
isEnabled: isWorkspaceSidebarCollapseEnabled,
41+
help: workspaceSidebarCollapseHelp
4442
) {
43+
guard isWorkspaceSidebarCollapseEnabled else { return }
4544
workspaceSidebarSplitLayout.wrappedValue.isPrimaryCollapsed.toggle()
4645
}
4746

@@ -120,6 +119,12 @@ struct RootView: View {
120119
.task {
121120
await appState.checkForUpdatesAtLaunch()
122121
}
122+
.onAppear {
123+
ensureWorkspaceSidebarVisibleForCurrentSection()
124+
}
125+
.onChange(of: appState.selectedSection) { _, _ in
126+
ensureWorkspaceSidebarVisibleForCurrentSection()
127+
}
123128
}
124129

125130
@ViewBuilder
@@ -164,6 +169,20 @@ struct RootView: View {
164169
}
165170
}
166171

172+
private var isWorkspaceSidebarCollapseEnabled: Bool {
173+
appState.selectedSection != .terminal
174+
}
175+
176+
private var workspaceSidebarCollapseHelp: String {
177+
if !isWorkspaceSidebarCollapseEnabled {
178+
return L10n.string("Workspace Sidebar is always visible in Terminal")
179+
}
180+
181+
return isWorkspaceSidebarCollapsed
182+
? L10n.string("Show Workspace Sidebar")
183+
: L10n.string("Hide Workspace Sidebar")
184+
}
185+
167186
private var currentWorkbenchPrimaryColumnLayout: Binding<HermesSplitLayout>? {
168187
guard appState.activeConnection != nil else { return nil }
169188

@@ -192,6 +211,11 @@ struct RootView: View {
192211
layout.wrappedValue.isPrimaryCollapsed.toggle()
193212
}
194213

214+
private func ensureWorkspaceSidebarVisibleForCurrentSection() {
215+
guard !isWorkspaceSidebarCollapseEnabled, isWorkspaceSidebarCollapsed else { return }
216+
workspaceSidebarSplitLayout.wrappedValue.isPrimaryCollapsed = false
217+
}
218+
195219
private var availableSections: [AppSection] {
196220
if appState.activeConnection == nil {
197221
return [.connections]

0 commit comments

Comments
 (0)