@@ -71,7 +71,7 @@ struct ViewCommands: Commands {
71
71
72
72
Divider ( )
73
73
74
- HideCommands ( )
74
+ HideCommands ( showEditorPathBar : $showEditorPathBar )
75
75
76
76
Divider ( )
77
77
@@ -94,6 +94,7 @@ struct ViewCommands: Commands {
94
94
extension ViewCommands {
95
95
struct HideCommands : View {
96
96
@UpdatingWindowController var windowController : CodeEditWindowController ?
97
+ @Binding var showEditorPathBar : Bool
97
98
98
99
var navigatorCollapsed : Bool {
99
100
windowController? . navigatorCollapsed ?? true
@@ -111,6 +112,18 @@ extension ViewCommands {
111
112
windowController? . toolbarCollapsed ?? true
112
113
}
113
114
115
+ private var labelForInterfaceToggle : String {
116
+ let shouldShow = navigatorCollapsed && inspectorCollapsed &&
117
+ toolbarCollapsed && !showEditorPathBar
118
+ return " \( shouldShow ? " Show " : " Hide " ) Interface "
119
+ }
120
+
121
+ private var isAnyPanelVisible : Bool {
122
+ return !navigatorCollapsed || !inspectorCollapsed ||
123
+ !utilityAreaCollapsed || !toolbarCollapsed ||
124
+ showEditorPathBar
125
+ }
126
+
114
127
var body : some View {
115
128
Button ( " \( navigatorCollapsed ? " Show " : " Hide " ) Navigator " ) {
116
129
windowController? . toggleFirstPanel ( )
@@ -135,6 +148,39 @@ extension ViewCommands {
135
148
}
136
149
. disabled ( windowController == nil )
137
150
. keyboardShortcut ( " t " , modifiers: [ . option, . command] )
151
+
152
+ Button ( labelForInterfaceToggle) {
153
+ if isAnyPanelVisible {
154
+ if !navigatorCollapsed {
155
+ windowController? . toggleFirstPanel ( )
156
+ }
157
+
158
+ if !inspectorCollapsed {
159
+ windowController? . toggleLastPanel ( )
160
+ }
161
+
162
+ if !utilityAreaCollapsed {
163
+ CommandManager . shared. executeCommand ( " open.drawer " )
164
+ }
165
+
166
+ if !toolbarCollapsed {
167
+ windowController? . toggleToolbar ( )
168
+ }
169
+
170
+ if showEditorPathBar {
171
+ showEditorPathBar. toggle ( )
172
+ }
173
+
174
+ } else {
175
+ // If all are closed, you can choose to open them again
176
+ windowController? . toggleFirstPanel ( )
177
+ windowController? . toggleLastPanel ( )
178
+ windowController? . toggleToolbar ( )
179
+ showEditorPathBar. toggle ( )
180
+ }
181
+ }
182
+ . disabled ( windowController == nil )
183
+ . keyboardShortcut ( " . " , modifiers: [ . command] )
138
184
}
139
185
}
140
186
}
0 commit comments