Commit 1f8e73bc44

1f8e73bc44bbf42b00b648fa98a5fc5c52741945

parent: d4ccb12cca

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-16 17:25 UTC

Hide folders from the agenda, by menu or Focus filter

A Folders menu in the agenda toolbar (Mac and iOS, with more than one
folder) shows or hides each folder's files; the shown folders' names go
under the title. The Hide Folders Focus filter hides its folders too while
the Focus is on and mutes their reminders through each notification's
filterCriteria. A folder either hides is left out of the agenda, widgets,
watch and badge. Both lists are kept per device in HiddenFolders.

Layout: unified · split

Sources/OrgApp/AgendaModel.swift +15 −3
@@ -38,6 +38,8 @@ public final class AgendaModel {
3838 public var includeSubfolders = false
3939 /// Files other agenda files archive to are left out.
4040 public var excludeArchives = OrgPreferences.agendaExcludeArchives()
41 /// Files in these folders (root paths) are left out; see `HiddenFolders`.
42 public var hiddenFolders: Set<String> = []
4143 /// `org-agenda-files`: when not empty, the agenda reads these instead of the folders' files.
4244 public var agendaFiles = OrgPreferences.agendaFiles()
4345 public var options = AgendaOptions()
@@ -68,7 +70,10 @@ public final class AgendaModel {
6870
6971 /// Org files directly in each folder (or below it, with `includeSubfolders`), by path, as
7072 /// Emacs lists a directory in `org-agenda-files`.
71 public var files: [String] { workspace.agendaFilePaths(list: agendaFiles, includeSubfolders: includeSubfolders) }
73 public var files: [String] {
74 let paths = workspace.agendaFilePaths(list: agendaFiles, includeSubfolders: includeSubfolders)
75 return hiddenFolders.isEmpty ? paths : paths.filter { !HiddenFolders.hides(hiddenFolders, path: $0) }
76 }
7277
7378 /// Recomputes the days. `open` is the open buffers' text by path.
7479 public func refresh(open: [String: String], now: Date = Date(), calendar: Calendar = .current) async {
@@ -139,10 +144,17 @@ public final class AgendaModel {
139144 isComputing = false
140145 }
141146
142 /// Reminders for the timed entries of the next `days` days.
147 /// Reminders for the timed entries of the next `days` days, each with the folder it is in.
143148 public func reminders(open: [String: String], now: Date = Date(), calendar: Calendar = .current, days: Int = 7, lead: Int = 12) async -> [Reminder] {
144149 let all = await sources(open: open)
145 return await Task.detached { Reminders.upcoming(all, now: now, calendar: calendar, days: days, lead: lead) }.value
150 let roots = workspace.rootPaths
151 return await Task.detached {
152 Reminders.upcoming(all, now: now, calendar: calendar, days: days, lead: lead).map { reminder in
153 var reminder = reminder
154 reminder.folder = roots.first { HiddenFolders.hides([$0], path: reminder.path) }
155 return reminder
156 }
157 }.value
146158 }
147159
148160 /// The habits of the agenda files, file by file.
Sources/OrgApp/HiddenFolders.swift added +40
@@ -0,0 +1,40 @@
1import Foundation
2import Observation
3
4/// The folders the agenda leaves out on this device, by root path: the ones hidden from the
5/// agenda's folder menu and the ones the active Focus filter hides. A folder either hides is
6/// hidden. Reminders stay on for both; the Focus filter mutes its folders' through the
7/// system, by each notification's `filterCriteria`.
8@MainActor
9@Observable
10public final class HiddenFolders {
11 public static let shared = HiddenFolders()
12
13 /// Hidden from the agenda's folder menu.
14 public var manual: Set<String> { didSet { defaults.set(manual.sorted(), forKey: Self.manualKey) } }
15 /// Hidden by the active Focus filter.
16 public var focus: Set<String> { didSet { defaults.set(focus.sorted(), forKey: Self.focusKey) } }
17
18 public var all: Set<String> { manual.union(focus) }
19
20 static let manualKey = "agendaHiddenFolders"
21 static let focusKey = "agendaFocusHiddenFolders"
22 @ObservationIgnored private let defaults: UserDefaults
23
24 public init(defaults: UserDefaults = .standard) {
25 self.defaults = defaults
26 manual = Set(defaults.stringArray(forKey: Self.manualKey) ?? [])
27 focus = Set(defaults.stringArray(forKey: Self.focusKey) ?? [])
28 }
29
30 /// `path` is one of `folders` or inside one.
31 public nonisolated static func hides(_ folders: Set<String>, path: String) -> Bool {
32 folders.contains { path == $0 || path.hasPrefix($0.hasSuffix("/") ? $0 : $0 + "/") }
33 }
34
35 /// For a Focus filter's app context: notifications whose `filterCriteria` (their folder) is
36 /// not one of `folders`.
37 public nonisolated static func notificationPredicate(hiding folders: Set<String>) -> NSPredicate {
38 NSPredicate(format: "NOT (SELF IN %@)", folders.sorted())
39 }
40}
Sources/OrgApp/ReminderScheduler.swift +1
@@ -99,6 +99,7 @@ public struct SystemReminderCenter: ReminderCenter {
9999 content.body = reminder.body
100100 content.sound = .default
101101 content.userInfo = ["path": reminder.path, "offset": reminder.offset]
102 if let folder = reminder.folder { content.filterCriteria = folder }
102103 let components = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: reminder.fireDate)
103104 let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: false)
104105 try await UNUserNotificationCenter.current().add(UNNotificationRequest(identifier: reminder.id, content: content, trigger: trigger))
Sources/OrgApp/WorkspaceModel.swift +9 −1
@@ -64,13 +64,21 @@ public final class WorkspaceModel {
6464 }
6565
6666 /// `~/Library/Application Support/Orgstar`, or `ORGSTAR_DATA_DIR` when set (for development).
67 public static var defaultDirectory: URL {
67 public nonisolated static var defaultDirectory: URL {
6868 if let override = ProcessInfo.processInfo.environment["ORGSTAR_DATA_DIR"] {
6969 return URL(fileURLWithPath: override)
7070 }
7171 return FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0].appendingPathComponent("Orgstar")
7272 }
7373
74 /// The resolved paths of the roots saved in `directory`, without opening the index: for
75 /// App Intents, which may run before the app's models.
76 public nonisolated static func savedRootPaths(in directory: URL = defaultDirectory) -> [String] {
77 guard let data = try? Data(contentsOf: directory.appendingPathComponent("roots.json")),
78 let roots = try? JSONDecoder().decode([WorkspaceRoot].self, from: data) else { return [] }
79 return roots.compactMap { try? $0.resolve().url.path }.sorted()
80 }
81
7482 // MARK: - Roots
7583
7684 public func addRoot(_ url: URL) async throws {
Sources/OrgCore/Agenda/Reminders.swift +2
@@ -10,6 +10,8 @@ public struct Reminder: Sendable, Equatable {
1010 public let body: String
1111 public let path: String
1212 public let offset: Int
13 /// The folder the entry's file is in, for Focus filters to mute.
14 public var folder: String?
1315
1416 public init(id: String, fireDate: Date, eventDate: Date, title: String, body: String, path: String, offset: Int) {
1517 self.id = id
Sources/Orgstar/AgendaView+Toolbar.swift +36
@@ -63,6 +63,7 @@ extension AgendaView {
6363 }
6464 }
6565 }
66 if workspace.rootPaths.count > 1 || hidesFolders { foldersMenu }
6667 Menu {
6768 Button("Filter…") { askFilter("/") }
6869 Button("By Tag…") { askFilter("\\") }
@@ -81,6 +82,41 @@ extension AgendaView {
8182 }
8283 }
8384
85 /// Shows or hides each folder's files; folders the Focus hides stay hidden.
86 private var foldersMenu: some View {
87 let hidden = HiddenFolders.shared
88 return Menu {
89 Button("All Folders") { hidden.manual = [] }
90 .disabled(hidden.manual.isEmpty)
91 Divider()
92 ForEach(workspace.rootPaths, id: \.self) { root in
93 Toggle((root as NSString).lastPathComponent, isOn: Binding {
94 !hidden.all.contains(root)
95 } set: { shown in
96 if shown { hidden.manual.remove(root) } else { hidden.manual.insert(root) }
97 })
98 .disabled(hidden.focus.contains(root))
99 }
100 if !hidden.focus.isDisjoint(with: workspace.rootPaths) {
101 Divider()
102 Text("Dimmed folders are hidden by the current Focus.")
103 }
104 } label: {
105 Label("Folders", systemImage: hidesFolders ? "folder.fill" : "folder")
106 }
107 .help("The folders the agenda shows")
108 }
109
110 /// Some folder is hidden.
111 var hidesFolders: Bool { !HiddenFolders.shared.all.isDisjoint(with: workspace.rootPaths) }
112
113 /// The folders shown, by name, while some are hidden.
114 var shownFolders: String? {
115 guard hidesFolders else { return nil }
116 let shown = workspace.rootPaths.filter { !HiddenFolders.shared.all.contains($0) }
117 return shown.isEmpty ? "No folders" : shown.map { ($0 as NSString).lastPathComponent }.joined(separator: ", ")
118 }
119
84120 /// The span shown, as the window's title: `Week of 5 Oct 2026`.
85121 var title: String {
86122 guard isAgenda else { return viewName.replacingOccurrences(of: "…", with: "") }
Sources/Orgstar/AgendaView.swift +7 −3
@@ -141,6 +141,7 @@ struct AgendaView: View {
141141 var startOffset: Int
142142 var startOnWeekday: String
143143 var includeSubfolders: Bool
144 var hidden: Set<String>
144145 var prefix: [String]
145146 var settings: [String]
146147 var logMode: Bool
@@ -156,7 +157,7 @@ struct AgendaView: View {
156157 /// they redraw only it.
157158 private var refreshKey: RefreshKey {
158159 RefreshKey(
159 mode: agenda.mode, start: agenda.start, span: span, startOffset: startOffset, startOnWeekday: startOnWeekday, includeSubfolders: includeSubfolders, prefix: [prefixAgenda, prefixTodo, prefixTags],
160 mode: agenda.mode, start: agenda.start, span: span, startOffset: startOffset, startOnWeekday: startOnWeekday, includeSubfolders: includeSubfolders, hidden: HiddenFolders.shared.all, prefix: [prefixAgenda, prefixTodo, prefixTags],
160161 settings: [sortAgenda, sortTodo, sortTags, sortSearch, gridWhen, gridTimes, "\(useTimeGrid) \(showCurrentTime)", stuckMatch, stuckTodo, stuckTags, stuckRegexp, agendaFileList],
161162 logMode: logMode,
162163 calendars: (calendarEventsOn ? [calendarNames] : []) + (remindersOn ? ["reminders", reminderListNames] : []), files: 0, changed: nil, edits: 0, path: nil, tick: tick
@@ -169,6 +170,7 @@ struct AgendaView: View {
169170 agenda.startOnWeekday = Int(startOnWeekday)
170171 agenda.includeSubfolders = includeSubfolders
171172 agenda.excludeArchives = OrgPreferences.agendaExcludeArchives()
173 agenda.hiddenFolders = HiddenFolders.shared.all
172174 agenda.agendaFiles = OrgPreferences.agendaFiles()
173175 agenda.options.prefixFormat = ["agenda": prefixAgenda, "todo": prefixTodo, "tags": prefixTags]
174176 agenda.options.logMode = logMode
@@ -353,8 +355,10 @@ struct AgendaView: View {
353355 }
354356 .toolbar { toolbar }
355357 .overlay {
356 if agenda.files.isEmpty {
358 if agenda.files.isEmpty, !hidesFolders {
357359 ContentUnavailableView("No agenda files", systemImage: "calendar", description: Text("The agenda reads the org files at the top of each folder you add."))
360 } else if agenda.files.isEmpty {
361 ContentUnavailableView("All folders hidden", systemImage: "folder", description: Text("Show a folder from the Folders menu."))
358362 }
359363 }
360364 .sheet(item: $eventRequest) { request in
@@ -412,7 +416,7 @@ struct AgendaView: View {
412416 }
413417 }
414418 .navigationTitle(title)
415 .navigationSubtitle(isAgenda && viewName != AgendaViewLoader.builtIn[0].name ? viewName : "")
419 .navigationSubtitle(([isAgenda && viewName != AgendaViewLoader.builtIn[0].name ? viewName : ""] + [shownFolders ?? ""]).filter { !$0.isEmpty }.joined(separator: " · "))
416420 .onChange(of: viewName) { applyView() }
417421 .onChange(of: commands.agendaRequest?.start, initial: true) { showRequestedDays() }
418422 .onChange(of: commands.agendaRequest?.days) { showRequestedDays() }
Sources/Orgstar/ContentView.swift +4 −1
@@ -459,7 +459,7 @@ struct ContentView: View {
459459 Text(workspace.lastError ?? session.lastError ?? "")
460460 }
461461 .task(id: ReminderKey(
462 enabled: remindersEnabled, lead: reminderLead, subfolders: agendaSubfolders, files: workspace.files.count,
462 enabled: remindersEnabled, lead: reminderLead, subfolders: agendaSubfolders, hidden: HiddenFolders.shared.all, files: workspace.files.count,
463463 changed: workspace.changedFile?.version, edits: session.editVersion, hour: hour, theme: theme
464464 )) {
465465 await updateReminders()
@@ -909,6 +909,8 @@ struct ContentView: View {
909909 var enabled: Bool
910910 var lead: Int
911911 var subfolders: Bool
912 /// The widgets leave out hidden folders.
913 var hidden: Set<String>
912914 var files: Int
913915 var changed: Int?
914916 var edits: Int
@@ -946,6 +948,7 @@ struct ContentView: View {
946948 days.startOnWeekday = nil
947949 days.includeSubfolders = agendaSubfolders
948950 days.excludeArchives = OrgPreferences.agendaExcludeArchives()
951 days.hiddenFolders = HiddenFolders.shared.all
949952 days.agendaFiles = OrgPreferences.agendaFiles()
950953 days.options = OrgPreferences.agendaOptions(days.options)
951954 days.options.logMode = false
Sources/Orgstar/FocusFilter.swift added +44
@@ -0,0 +1,44 @@
1import AppIntents
2import OrgApp
3
4/// A folder the user added, by its path.
5struct FolderEntity: AppEntity {
6 static let typeDisplayRepresentation: TypeDisplayRepresentation = "Folder"
7 static let defaultQuery = Query()
8
9 var id: String
10
11 var displayRepresentation: DisplayRepresentation {
12 DisplayRepresentation(title: "\((id as NSString).lastPathComponent)", subtitle: "\(id)")
13 }
14
15 struct Query: EntityQuery {
16 func entities(for identifiers: [String]) async throws -> [FolderEntity] { identifiers.map(FolderEntity.init) }
17 func suggestedEntities() async throws -> [FolderEntity] { WorkspaceModel.savedRootPaths().map(FolderEntity.init) }
18 }
19}
20
21/// While a Focus with this filter is on, the agenda and widgets leave out its folders and
22/// their reminders are muted. The system performs it again with no folders when the Focus ends.
23struct AgendaFocusFilter: SetFocusFilterIntent {
24 static let title: LocalizedStringResource = "Hide Folders"
25 static let description = IntentDescription("Leaves folders out of the agenda and widgets, and mutes their reminders, while this Focus is on.")
26
27 @Parameter(title: "Folders", default: [])
28 var folders: [FolderEntity]
29
30 var displayRepresentation: DisplayRepresentation {
31 let names = folders.map { ($0.id as NSString).lastPathComponent }.joined(separator: ", ")
32 return DisplayRepresentation(title: names.isEmpty ? "No folders hidden" : "Hide \(names)")
33 }
34
35 var appContext: FocusFilterAppContext {
36 FocusFilterAppContext(notificationFilterPredicate: HiddenFolders.notificationPredicate(hiding: Set(folders.map(\.id))))
37 }
38
39 @MainActor
40 func perform() async throws -> some IntentResult {
41 HiddenFolders.shared.focus = Set(folders.map(\.id))
42 return .result()
43 }
44}
Sources/OrgstarMobile/AgendaScreen.swift +37 −1
@@ -90,6 +90,7 @@ struct AgendaScreen: View, Equatable {
9090 var span: Int
9191 var startOffset: Int
9292 var subfolders: Bool
93 var hidden: Set<String>
9394 var settings: Int
9495 var logMode: Bool
9596 }
@@ -151,6 +152,7 @@ struct AgendaScreen: View, Equatable {
151152 // The now line is shorter than a row.
152153 .environment(\.defaultMinListRowHeight, 16)
153154 .navigationTitle(title)
155 .navigationSubtitle(shownFolders ?? "")
154156 .navigationBarTitleDisplayMode(.inline)
155157 .sensoryFeedback(.success, trigger: done)
156158 .sensoryFeedback(.impact(weight: .light), trigger: moved)
@@ -212,6 +214,9 @@ struct AgendaScreen: View, Equatable {
212214 Label("Views", systemImage: "list.bullet.rectangle")
213215 }
214216 }
217 if workspace.rootPaths.count > 1 || shownFolders != nil {
218 ToolbarItem(placement: .topBarTrailing) { foldersMenu }
219 }
215220 }
216221 .fullScreenCover(isPresented: $showingBoard) {
217222 BoardScreen(workspace: workspace, session: session) { showingBoard = false }
@@ -318,6 +323,36 @@ struct AgendaScreen: View, Equatable {
318323 .background { Refresher(workspace: workspace, session: session, agenda: agenda, model: model, tick: tick, logMode: logMode) }
319324 }
320325
326 /// Shows or hides each folder's files; folders the Focus hides stay hidden.
327 private var foldersMenu: some View {
328 let hidden = HiddenFolders.shared
329 let hides = !hidden.all.isDisjoint(with: workspace.rootPaths)
330 return Menu {
331 Button("All Folders", systemImage: "folder") { hidden.manual = [] }
332 .disabled(hidden.manual.isEmpty)
333 Section(hidden.focus.isDisjoint(with: workspace.rootPaths) ? "" : "Dimmed folders are hidden by the current Focus.") {
334 ForEach(workspace.rootPaths, id: \.self) { root in
335 Toggle((root as NSString).lastPathComponent, isOn: Binding {
336 !hidden.all.contains(root)
337 } set: { shown in
338 if shown { hidden.manual.remove(root) } else { hidden.manual.insert(root) }
339 })
340 .disabled(hidden.focus.contains(root))
341 }
342 }
343 } label: {
344 Label("Folders", systemImage: hides ? "folder.fill" : "folder")
345 }
346 }
347
348 /// The folders shown, by name, while some are hidden.
349 private var shownFolders: String? {
350 let hidden = HiddenFolders.shared.all
351 guard !hidden.isDisjoint(with: workspace.rootPaths) else { return nil }
352 let shown = workspace.rootPaths.filter { !hidden.contains($0) }
353 return shown.isEmpty ? "No folders" : shown.map { ($0 as NSString).lastPathComponent }.joined(separator: ", ")
354 }
355
321356 /// Refreshes the agenda when files, edits or settings change. Its own view, so that what it
322357 /// watches redraws only it, not the whole list.
323358 private struct Refresher: View {
@@ -332,11 +367,12 @@ struct AgendaScreen: View, Equatable {
332367 Color.clear
333368 .task(id: Key(files: workspace.files.count, changed: workspace.changedFile?.version, edits: session.editVersion, tick: tick,
334369 mode: agenda.mode, start: agenda.start, span: agenda.span, startOffset: agenda.startOffset,
335 subfolders: agenda.includeSubfolders, settings: model.settingsVersion, logMode: logMode)) {
370 subfolders: agenda.includeSubfolders, hidden: HiddenFolders.shared.all, settings: model.settingsVersion, logMode: logMode)) {
336371 // Changes come in bursts (a folder scan, typing); a newer one cancels this wait.
337372 try? await Task.sleep(for: .milliseconds(150))
338373 guard !Task.isCancelled else { return }
339374 agenda.options.logMode = logMode
375 agenda.hiddenFolders = HiddenFolders.shared.all
340376 await agenda.refresh(open: session.openTexts)
341377 }
342378 }
Sources/OrgstarMobile/FocusFilter.swift added +48
@@ -0,0 +1,48 @@
1#if os(iOS)
2import AppIntents
3import OrgApp
4
5/// A folder the user added, by its path.
6struct FolderEntity: AppEntity {
7 static let typeDisplayRepresentation: TypeDisplayRepresentation = "Folder"
8 static let defaultQuery = Query()
9
10 var id: String
11
12 var displayRepresentation: DisplayRepresentation {
13 DisplayRepresentation(title: "\((id as NSString).lastPathComponent)", subtitle: "\(id)")
14 }
15
16 struct Query: EntityQuery {
17 func entities(for identifiers: [String]) async throws -> [FolderEntity] { identifiers.map(FolderEntity.init) }
18 func suggestedEntities() async throws -> [FolderEntity] { WorkspaceModel.savedRootPaths().map(FolderEntity.init) }
19 }
20}
21
22/// While a Focus with this filter is on, the agenda and widgets leave out its folders and
23/// their reminders are muted. The system performs it again with no folders when the Focus ends.
24struct AgendaFocusFilter: SetFocusFilterIntent {
25 static let title: LocalizedStringResource = "Hide Folders"
26 static let description = IntentDescription("Leaves folders out of the agenda and widgets, and mutes their reminders, while this Focus is on.")
27
28 @Parameter(title: "Folders", default: [])
29 var folders: [FolderEntity]
30
31 var displayRepresentation: DisplayRepresentation {
32 let names = folders.map { ($0.id as NSString).lastPathComponent }.joined(separator: ", ")
33 return DisplayRepresentation(title: names.isEmpty ? "No folders hidden" : "Hide \(names)")
34 }
35
36 var appContext: FocusFilterAppContext {
37 FocusFilterAppContext(notificationFilterPredicate: HiddenFolders.notificationPredicate(hiding: Set(folders.map(\.id))))
38 }
39
40 @MainActor
41 func perform() async throws -> some IntentResult {
42 HiddenFolders.shared.focus = Set(folders.map(\.id))
43 // The app may be in the background, where the widgets would wait for it to come back.
44 await MobileModel.shared.updateWidgets()
45 return .result()
46 }
47}
48#endif
Sources/OrgstarMobile/MobileModel.swift +1
@@ -295,6 +295,7 @@ final class MobileModel {
295295 let days = AgendaModel(workspace: workspace, cache: agenda?.cache ?? AgendaSourceCache())
296296 days.mode = .agenda(span: AgendaSnapshot.dayCount, startOffset: 0)
297297 days.startOnWeekday = nil
298 days.hiddenFolders = HiddenFolders.shared.all
298299 if let agenda {
299300 days.includeSubfolders = agenda.includeSubfolders
300301 days.excludeArchives = agenda.excludeArchives
Sources/OrgstarMobile/OrgstarMobileApp.swift +3 −1
@@ -136,7 +136,7 @@ struct RootView: View {
136136 var body: some View {
137137 Color.clear
138138 // Reminders follow the files, the settings, coming back to the app and the hour.
139 .task(id: ReminderKey(files: workspace.files.count, changed: workspace.changedFile?.version, edits: session.editVersion,
139 .task(id: ReminderKey(hidden: HiddenFolders.shared.all, files: workspace.files.count, changed: workspace.changedFile?.version, edits: session.editVersion,
140140 settings: model.settingsVersion, active: active, hour: hour)) {
141141 guard active else { return }
142142 try? await Task.sleep(for: .seconds(1))
@@ -160,6 +160,8 @@ struct RootView: View {
160160 }
161161
162162 private struct ReminderKey: Equatable {
163 /// The widgets leave out hidden folders.
164 var hidden: Set<String>
163165 var files: Int
164166 var changed: Int?
165167 var edits: Int
Tests/OrgAppTests/AppTests.swift +39
@@ -654,6 +654,45 @@ struct AgendaModelTests {
654654 await agenda.refresh(open: [:], now: now, calendar: utc)
655655 #expect(Set(agenda.days[0].items.map(\.text)) == ["TODO Live", "TODO Task", "TODO Mine"])
656656 }
657
658 @Test func leavesOutHiddenFoldersAndTagsReminders() async throws {
659 let work = try Folder()
660 let home = try Folder()
661 try work.write("work.org", "* TODO Report\nSCHEDULED: <2026-10-05 Mon 14:00>\n")
662 try home.write("home.org", "* TODO Groceries\nSCHEDULED: <2026-10-05 Mon 15:00>\n")
663 let model = try WorkspaceModel(directory: nil)
664 try await model.addRoot(work.url)
665 try await model.addRoot(home.url)
666 let workRoot = try #require(model.files.first { $0.name == "work.org" }?.root)
667 let agenda = AgendaModel(workspace: model)
668 agenda.span = 1
669 var utc = Calendar(identifier: .gregorian)
670 utc.timeZone = TimeZone(identifier: "UTC")!
671 let now = try #require(utc.date(from: DateComponents(year: 2026, month: 10, day: 5, hour: 9)))
672
673 agenda.hiddenFolders = [workRoot]
674 await agenda.refresh(open: [:], now: now, calendar: utc)
675 #expect(agenda.days[0].items.filter { $0.path != nil }.map(\.title) == ["Groceries"])
676
677 // Reminders keep hidden folders' entries and carry their folder for Focus filters.
678 let reminders = await AgendaModel(workspace: model).reminders(open: [:], now: now, calendar: utc)
679 #expect(Set(reminders.map(\.title)) == ["Report", "Groceries"])
680 #expect(reminders.first { $0.title == "Report" }?.folder == workRoot)
681 }
682
683 @Test func hiddenFoldersPersistAndMatchPaths() {
684 let defaults = UserDefaults(suiteName: "hidden-\(UUID().uuidString)")!
685 let folders = HiddenFolders(defaults: defaults)
686 folders.manual = ["/a"]
687 folders.focus = ["/b"]
688 let reloaded = HiddenFolders(defaults: defaults)
689 #expect(reloaded.all == ["/a", "/b"])
690 #expect(HiddenFolders.hides(["/a"], path: "/a/x.org"))
691 #expect(!HiddenFolders.hides(["/a"], path: "/ab/x.org"))
692 let predicate = HiddenFolders.notificationPredicate(hiding: ["/a"])
693 #expect(!predicate.evaluate(with: "/a"))
694 #expect(predicate.evaluate(with: "/b"))
695 }
657696}
658697
659698@MainActor
docs/manual/guide/07-agenda.org +6
@@ -64,6 +64,12 @@ An entry's category is the nearest =CATEGORY= property on it or an ancestor, els
6464
6565If no agenda file exists, the window says so.
6666
67** Hiding folders
68
69With more than one folder, the Folders menu in the agenda's toolbar shows or hides each folder's files; All Folders shows them all again. While some are hidden, the shown folders' names appear under the title. The choice is kept on each device, and it applies to the agenda, the widgets, the Apple Watch and the iOS icon's badge. Reminders still fire for hidden folders.
70
71To hide folders with a Focus, add orgstar's Hide Folders filter to the Focus in System Settings ▸ Focus (Settings ▸ Focus on iOS) and choose the folders. While the Focus is on, those folders are hidden as well as the ones you hid from the menu, where they show dimmed, and their reminders are muted. When the Focus ends they show again.
72
6773* The day, week and month view
6874
6975The default view is =org-agenda-list=: a run of days, each under a header with its date, such as =Monday 5 October= (with the year when it isn't the current year). Today, tomorrow and yesterday are named before the date: =Today · Thursday 8 October=. Today's header is in the =agenda-today= color and days before today are grey. Each header stays at the top of the window while you scroll through its day.
docs/manual/guide/14-ios.org +1
@@ -189,6 +189,7 @@ Tap a result to open it in the reader. A heading result opens at that heading.
189189The Agenda tab shows the agenda over all your folders, with the span and start day from the settings (10 days from 3 days ago by default). Each day lists its entries in rows: the time or a status such as =Due today= or =3d late= on the left, the category and the keyword above the title. Days without entries are hidden, except today. Today's overdue entries are in a group of their own, and a line marks the current time between timed entries. Pull down to refresh.
190190
191191- Views (top left) :: the built-in views and those in =views.toml=, Tags and Properties… (a match such as =+work-home= or ~TODO="WAIT"~), and Search… (a phrase, or snippets such as =+invoice -paid=).
192- Folders (top right, with more than one folder) :: shows or hides each folder's files in the agenda, the widgets, the watch and the badge; the shown folders' names appear under the title. A Focus can hide folders too, and mute their reminders (see Hiding folders in [[file:07-agenda.org][The agenda]]).
192193- The bar at the bottom :: Earlier, Filter, Today, Go to Date, the span (Day, Week, Month or the configured span, and Log Mode, which adds closed entries and clocked time) and Later.
193194- Filter :: keep or leave out tags and categories of the entries shown, or type a filter as Org's =/= takes it: =+keep= and =-drop= tags or categories, =<0:30= for effort, =/regexp/=. The filter in use shows above the bar.
194195- + on a day's header :: captures an entry scheduled on that day (see [[file:08-capture.org][Capture]]).