Skip to content

Commit da0c466

Browse files
committed
ux: add 'hide hidden folders' to menu bar
Signed-off-by: Tommy van der Vorst <tommy@pixelspark.nl>
1 parent 2f32afb commit da0c466

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

Sushitrain/App.swift

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -185,39 +185,17 @@ struct SushitrainApp: App {
185185
}
186186
#endif
187187
}
188+
.commands {
189+
self.commands()
190+
}
188191
#if os(macOS)
189192
.handlesExternalEvents(matching: ["*"])
190193

191194
.onChange(of: hideInDock, initial: true) { _ov, nv in
192195
NSApp.setActivationPolicy(nv ? .accessory : .regular)
193196
NSApp.activate(ignoringOtherApps: true)
194197
}
195-
.commands {
196-
CommandGroup(after: .sidebar) {
197-
Toggle("Hide dotfiles", isOn: appState.userSettings.$dotFilesHidden)
198-
}
199-
200-
CommandGroup(replacing: CommandGroupPlacement.help) {
201-
Button("Questions, support & feedback...") {
202-
openWindow(id: "support")
203-
}
204-
}
205-
206-
CommandGroup(replacing: CommandGroupPlacement.appInfo) {
207-
Button("About Synctrain") {
208-
// Open the "about" window
209-
openWindow(id: "about")
210-
}
211198

212-
Button("Statistics...") {
213-
openWindow(id: "stats")
214-
}
215-
216-
Button("Decrypt a folder...") {
217-
openWindow(id: "decrypter")
218-
}
219-
}
220-
}
221199
.defaultLaunchBehavior(hideInDock ? .suppressed : .presented)
222200
.restorationBehavior(hideInDock ? .disabled : .automatic)
223201

@@ -264,6 +242,37 @@ struct SushitrainApp: App {
264242
.windowResizability(.contentSize)
265243
#endif
266244
}
245+
246+
@CommandsBuilder private func commands() -> some Commands {
247+
CommandGroup(after: .sidebar) {
248+
Toggle("Hide dotfiles", isOn: appState.userSettings.$dotFilesHidden)
249+
250+
Toggle("Hide hidden folders", isOn: appState.userSettings.$hideHiddenFolders)
251+
}
252+
253+
#if os(macOS)
254+
CommandGroup(replacing: CommandGroupPlacement.help) {
255+
Button("Questions, support & feedback...") {
256+
openWindow(id: "support")
257+
}
258+
}
259+
260+
CommandGroup(replacing: CommandGroupPlacement.appInfo) {
261+
Button("About Synctrain") {
262+
// Open the "about" window
263+
openWindow(id: "about")
264+
}
265+
266+
Button("Statistics...") {
267+
openWindow(id: "stats")
268+
}
269+
270+
Button("Decrypt a folder...") {
271+
openWindow(id: "decrypter")
272+
}
273+
}
274+
#endif
275+
}
267276
}
268277

269278
#if os(macOS)

0 commit comments

Comments
 (0)