Commit 035009dce5

035009dce58286b0a61a010a3003e59ab3515cc9

parent: 62cf46e9d3

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 03:29 UTC

Put the sidebar's agenda switch in its bottom bar

One bar under the sidebar: add and remove folder for the files, or the
view menu for the agenda, and at its right the button that switches
between the two. The segmented control at the top is gone, and the bar's
buttons are larger with a rule above them.

Ref #92

Layout: unified · split

Sources/OrgApp/WhatsNew.swift +1 −1
@@ -68,7 +68,7 @@ public enum WhatsNew {
6868 private static let ios: [ReleaseNotes.Item] = []
6969 private static let mac = [
7070 ReleaseNotes.Item("sidebar.left", "Agenda in the sidebar",
71 "The Agenda button at the top of the sidebar shows your agenda, or a view from views.toml, beside the editor."),
71 "The calendar button under the sidebar shows your agenda, or a view from views.toml, beside the editor."),
7272 ReleaseNotes.Item("menubar.rectangle", "orgstar in the menu bar",
7373 "Settings ▸ General ▸ Keep orgstar in the menu bar adds capture, the agenda and today's entries to the menu bar."),
7474 ]
Sources/Orgstar/AgendaSidebar.swift +8 −8
@@ -3,7 +3,7 @@ import OrgCore
33import OrgPresentation
44import SwiftUI
55
6/// The sidebar's Agenda tab: the agenda, or one of the named views, as a narrow list beside the
6/// The sidebar's agenda: the agenda, or one of the named views, as a narrow list beside the
77/// editor. A click on an entry shows it in the editor. It follows the Agenda window's span and
88/// files, and shows Calendar events and Reminders only once the Agenda window has asked for them.
99struct AgendaSidebar: View {
@@ -12,6 +12,7 @@ struct AgendaSidebar: View {
1212 let commands: AppCommands
1313 /// Changes every hour, so that the day rolls over.
1414 let hour: Int
15 @Binding var showsAgenda: Bool
1516 @State private var agenda: AgendaModel
1617 @State private var views = AgendaViewLoader.builtIn
1718 @AppStorage("sidebarAgendaView") private var viewName = AgendaViewLoader.builtIn[0].name
@@ -24,11 +25,12 @@ struct AgendaSidebar: View {
2425 @Environment(\.colorScheme) private var colorScheme
2526 @Environment(\.openWindow) private var openWindow
2627
27 init(workspace: WorkspaceModel, session: DocumentSession, commands: AppCommands, hour: Int) {
28 init(workspace: WorkspaceModel, session: DocumentSession, commands: AppCommands, hour: Int, showsAgenda: Binding<Bool>) {
2829 self.workspace = workspace
2930 self.session = session
3031 self.commands = commands
3132 self.hour = hour
33 _showsAgenda = showsAgenda
3234 _agenda = State(initialValue: AgendaModel(workspace: workspace))
3335 }
3436
@@ -94,8 +96,10 @@ struct AgendaSidebar: View {
9496 }
9597 }
9698 }
97 .safeAreaInset(edge: .top, spacing: 0) {
98 HStack {
99 .listStyle(.sidebar)
100 .themedListBackground(theme.color("sidebar-background", in: colorScheme))
101 .safeAreaInset(edge: .bottom, spacing: 0) {
102 SidebarBar(showsAgenda: $showsAgenda) {
99103 Menu {
100104 ForEach(views) { view in Button(view.name) { viewName = view.name } }
101105 Divider()
@@ -103,13 +107,9 @@ struct AgendaSidebar: View {
103107 } label: {
104108 Text(view.name)
105109 }
106 .menuStyle(.borderlessButton)
107110 .fixedSize()
108111 .help("The agenda view shown here; add views in views.toml")
109 Spacer()
110112 }
111 .padding(.horizontal, 12)
112 .padding(.vertical, 4)
113113 }
114114 .task(id: Key(
115115 view: viewName, mode: views.first { $0.name == viewName }?.mode, settings: ["\(span)", "\(startOffset)", startOnWeekday, "\(includeSubfolders)", agendaFileList],
Sources/Orgstar/ContentView.swift +2 −12
@@ -247,21 +247,11 @@ struct ContentView: View {
247247 NavigationSplitView {
248248 Group {
249249 if sidebarAgenda {
250 AgendaSidebar(workspace: workspace, session: session, commands: commands, hour: hour)
250 AgendaSidebar(workspace: workspace, session: session, commands: commands, hour: hour, showsAgenda: $sidebarAgenda)
251251 } else {
252 Sidebar(workspace: workspace, session: session, selection: $selectedFile) { commands.showingFolderPicker = true }
252 Sidebar(workspace: workspace, session: session, selection: $selectedFile, showsAgenda: $sidebarAgenda) { commands.showingFolderPicker = true }
253253 }
254254 }
255 .safeAreaInset(edge: .top, spacing: 0) {
256 Picker("Sidebar", selection: $sidebarAgenda) {
257 Text("Files").tag(false)
258 Text("Agenda").tag(true)
259 }
260 .pickerStyle(.segmented)
261 .labelsHidden()
262 .padding(.horizontal, 10)
263 .padding(.bottom, 6)
264 }
265255 .navigationSplitViewColumnWidth(min: 200, ideal: 260)
266256 } detail: {
267257 HStack(spacing: 0) {
Sources/Orgstar/Sidebar.swift +28 −6
@@ -8,6 +8,8 @@ struct Sidebar: View {
88 let workspace: WorkspaceModel
99 let session: DocumentSession
1010 @Binding var selection: String?
11 /// The sidebar shows the agenda in place of the files.
12 @Binding var showsAgenda: Bool
1113 var addFolder: () -> Void = {}
1214 /// Folders shown collapsed, by path, one per line.
1315 @AppStorage("collapsedFolders") private var collapsedText = ""
@@ -74,7 +76,7 @@ struct Sidebar: View {
7476 .listStyle(.sidebar)
7577 .themedListBackground(theme.color("sidebar-background", in: colorScheme))
7678 .safeAreaInset(edge: .bottom, spacing: 0) {
77 HStack(spacing: 4) {
79 SidebarBar(showsAgenda: $showsAgenda) {
7880 Button("Add Folder…", systemImage: "plus", action: addFolder)
7981 .help("Add a folder (⇧⌘O)")
8082 Menu {
@@ -88,13 +90,8 @@ struct Sidebar: View {
8890 .fixedSize()
8991 .disabled(workspace.rootPaths.isEmpty)
9092 .help("Remove a folder from the sidebar")
91 Spacer()
9293 }
9394 .labelStyle(.iconOnly)
94 .buttonStyle(.borderless)
95 .menuStyle(.borderlessButton)
96 .padding(.horizontal, 10)
97 .padding(.vertical, 6)
9895 }
9996 .confirmationDialog(
10097 "Remove “\(removing.map { ($0 as NSString).lastPathComponent } ?? "")” from the sidebar?",
@@ -139,6 +136,31 @@ struct Sidebar: View {
139136 }
140137}
141138
139/// The bar under the sidebar: what the shown side offers, then the button that switches between
140/// the files and the agenda.
141struct SidebarBar<Content: View>: View {
142 @Binding var showsAgenda: Bool
143 @ViewBuilder var content: Content
144 @Environment(\.orgTheme) private var theme
145
146 var body: some View {
147 HStack(spacing: 6) {
148 content
149 Spacer()
150 Button(showsAgenda ? "Show Files" : "Show Agenda", systemImage: showsAgenda ? "folder" : "calendar") { showsAgenda.toggle() }
151 .labelStyle(.iconOnly)
152 .help(showsAgenda ? "Show the files" : "Show the agenda")
153 }
154 .buttonStyle(.borderless)
155 .menuStyle(.borderlessButton)
156 .font(.system(size: 14, weight: .medium))
157 .foregroundStyle(theme.color("sidebar-foreground") ?? .primary)
158 .padding(.horizontal, 10)
159 .padding(.vertical, 7)
160 .overlay(alignment: .top) { Divider() }
161 }
162}
163
142164struct OutlineColumn: View {
143165 let session: DocumentSession
144166 @Environment(\.orgTheme) private var theme
docs/manual/guide/01-files-and-folders.org +1 −1
@@ -36,7 +36,7 @@ Several commands in this chapter are only in the palette, not in a menu: Close O
3636| View ▸ Show or Hide Columns and Clock | =⌥⌘I= | Show or Hide Columns and Clock |
3737| View ▸ Show Tab Bar | | Show or Hide Tab Bar |
3838
39The toolbar's outline button does the same as View ▸ Show or Hide Outline. The sidebar is shown and hidden with the standard View menu command. Its Files and Agenda buttons switch it between the files and an agenda; see [[file:07-agenda.org][The agenda]].
39The toolbar's outline button does the same as View ▸ Show or Hide Outline. The sidebar is shown and hidden with the standard View menu command. The button at the right of the bar under it switches it between the files and an agenda; see [[file:07-agenda.org][The agenda]].
4040
4141orgstar remembers whether the outline, backlinks and inspector are shown. The outline pane's visibility is remembered for org files only: for other files it starts hidden each time you open one. Drag the divider on the outline pane's right edge to resize it (160 to 400 points; 220 by default).
4242
docs/manual/guide/03-keys.org +1 −1
@@ -1104,7 +1104,7 @@ No preset binds these. Run them from the palette or a menu, or bind them in =key
11041104| Command | What it does |
11051105|-+-|
11061106| Board (=app.board=) | Opens the Board window. Window ▸ Board, =⇧⌘B=. |
1107| Show Agenda or Files in Sidebar (=app.sidebar-agenda=) | Switches the sidebar between the files and the agenda, as its Files and Agenda buttons do. |
1107| Show Agenda or Files in Sidebar (=app.sidebar-agenda=) | Switches the sidebar between the files and the agenda, as the button at the right of its bar does. |
11081108| Verbatim, Code, Strike-Through (=org.emphasize.verbatim=, =org.emphasize.code=, =org.emphasize.strike-through=) | =org-emphasize= with ===, =~= or =+=. |
11091109| Cancel Running Task (=app.babel.cancel=) | Stops the src block that is running, or an export or table recalculation running in Emacs. Edit ▸ Cancel Running Task, =⌘.=. |
11101110| Edit Config File (=app.edit-config=) | Opens =config.toml= in the editor. =⌥⌘,=. |
docs/manual/guide/07-agenda.org +2 −2
@@ -467,9 +467,9 @@ The search covers the agenda files only, not =org-agenda-text-search-extra-files
467467
468468The view menu lists the built-in views, Agenda, TODO List and Stuck Projects, then the views in =views.toml=, then Match…, TODO Match…, Search… and TODO Search…. Saved views mirror =org-agenda-custom-commands=, with fewer options.
469469
470*In the sidebar.* On the Mac, the Agenda button at the top of the main window's sidebar shows an agenda in place of the files, beside the editor; Files brings the files back, and Show Agenda or Files in Sidebar (=app.sidebar-agenda=) switches between them.
470*In the sidebar.* On the Mac, the calendar button at the right of the bar under the main window's sidebar shows an agenda in place of the files, beside the editor; the same button, then a folder, brings the files back, and Show Agenda or Files in Sidebar (=app.sidebar-agenda=) switches between them.
471471
472- Its menu lists the built-in views and those in =views.toml=, and Open Agenda Window. The view chosen is remembered.
472- The menu at the left of the bar, where the files have their =+= and =−=, lists the built-in views and those in =views.toml=, and Open Agenda Window. The view chosen is remembered.
473473- Days with entries are listed with their entries, today's overdue ones first; a list view or a block shows under its title. Each line has the time or status, the TODO keyword, the title and the category.
474474- A click on an entry shows it in the editor.
475475- It uses the Agenda window's span, start, folders and agenda files. Calendar events and Reminders show once the Agenda window has been given access to them.
l10n/Localizable.xcstrings +167 −65
@@ -28426,6 +28426,40 @@
2842628426 }
2842728427 }
2842828428 },
28429 "Show Agenda": {
28430 "localizations": {
28431 "de": {
28432 "stringUnit": {
28433 "state": "translated",
28434 "value": "Agenda anzeigen"
28435 }
28436 },
28437 "es": {
28438 "stringUnit": {
28439 "state": "translated",
28440 "value": "Mostrar agenda"
28441 }
28442 },
28443 "fr": {
28444 "stringUnit": {
28445 "state": "translated",
28446 "value": "Afficher l'agenda"
28447 }
28448 },
28449 "ja": {
28450 "stringUnit": {
28451 "state": "translated",
28452 "value": "アジェンダを表示"
28453 }
28454 },
28455 "pt-BR": {
28456 "stringUnit": {
28457 "state": "translated",
28458 "value": "Mostrar Agenda"
28459 }
28460 }
28461 }
28462 },
2842928463 "Show Agenda or Files in Sidebar": {
2843028464 "localizations": {
2843128465 "de": {
@@ -28598,6 +28632,40 @@
2859828632 }
2859928633 }
2860028634 },
28635 "Show Files": {
28636 "localizations": {
28637 "de": {
28638 "stringUnit": {
28639 "state": "translated",
28640 "value": "Dateien anzeigen"
28641 }
28642 },
28643 "es": {
28644 "stringUnit": {
28645 "state": "translated",
28646 "value": "Mostrar archivos"
28647 }
28648 },
28649 "fr": {
28650 "stringUnit": {
28651 "state": "translated",
28652 "value": "Afficher les fichiers"
28653 }
28654 },
28655 "ja": {
28656 "stringUnit": {
28657 "state": "translated",
28658 "value": "ファイルを表示"
28659 }
28660 },
28661 "pt-BR": {
28662 "stringUnit": {
28663 "state": "translated",
28664 "value": "Mostrar Arquivos"
28665 }
28666 }
28667 }
28668 },
2860128669 "Show Line Numbers": {
2860228670 "localizations": {
2860328671 "de": {
@@ -29661,174 +29729,208 @@
2966129729 }
2966229730 }
2966329731 },
29664 "Show the outline (⌥⌘O)": {
29732 "Show the agenda": {
2966529733 "localizations": {
2966629734 "de": {
2966729735 "stringUnit": {
2966829736 "state": "translated",
29669 "value": "Gliederung zeigen (⌥⌘O)"
29737 "value": "Agenda anzeigen"
2967029738 }
2967129739 },
2967229740 "es": {
2967329741 "stringUnit": {
2967429742 "state": "translated",
29675 "value": "Mostrar el esquema (⌥⌘O)"
29743 "value": "Mostrar la agenda"
2967629744 }
2967729745 },
2967829746 "fr": {
2967929747 "stringUnit": {
2968029748 "state": "translated",
29681 "value": "Afficher la structure (⌥⌘O)"
29749 "value": "Afficher l'agenda"
2968229750 }
2968329751 },
2968429752 "ja": {
2968529753 "stringUnit": {
2968629754 "state": "translated",
29687 "value": "アウトラインを表示(⌥⌘O)"
29755 "value": "アジェンダを表示"
2968829756 }
2968929757 },
2969029758 "pt-BR": {
2969129759 "stringUnit": {
2969229760 "state": "translated",
29693 "value": "Mostrar a estrutura (⌥⌘O)"
29761 "value": "Mostrar a agenda"
2969429762 }
2969529763 }
2969629764 }
2969729765 },
29698 "Shown as usual": {
29766 "Show the files": {
2969929767 "localizations": {
2970029768 "de": {
2970129769 "stringUnit": {
2970229770 "state": "translated",
29703 "value": "Normal angezeigt"
29771 "value": "Dateien anzeigen"
2970429772 }
2970529773 },
2970629774 "es": {
2970729775 "stringUnit": {
2970829776 "state": "translated",
29709 "value": "Se muestran como siempre"
29777 "value": "Mostrar los archivos"
2971029778 }
2971129779 },
2971229780 "fr": {
2971329781 "stringUnit": {
2971429782 "state": "translated",
29715 "value": "Affichées normalement"
29783 "value": "Afficher les fichiers"
2971629784 }
2971729785 },
2971829786 "ja": {
2971929787 "stringUnit": {
2972029788 "state": "translated",
29721 "value": "通常どおり表示"
29789 "value": "ファイルを表示"
2972229790 }
2972329791 },
2972429792 "pt-BR": {
2972529793 "stringUnit": {
2972629794 "state": "translated",
29727 "value": "Mostradas normalmente"
29795 "value": "Mostrar os arquivos"
2972829796 }
2972929797 }
2973029798 }
2973129799 },
29732 "Shrink Table Columns with Widths": {
29733 "comment": "Command title",
29800 "Show the outline (⌥⌘O)": {
2973429801 "localizations": {
2973529802 "de": {
2973629803 "stringUnit": {
2973729804 "state": "translated",
29738 "value": "Tabellenspalten mit Breite verkleinern"
29805 "value": "Gliederung zeigen (⌥⌘O)"
2973929806 }
2974029807 },
2974129808 "es": {
2974229809 "stringUnit": {
2974329810 "state": "translated",
29744 "value": "Reducir columnas de la tabla con ancho definido"
29811 "value": "Mostrar el esquema (⌥⌘O)"
2974529812 }
2974629813 },
2974729814 "fr": {
2974829815 "stringUnit": {
2974929816 "state": "translated",
29750 "value": "Réduire les colonnes du tableau à leur largeur"
29817 "value": "Afficher la structure (⌥⌘O)"
2975129818 }
2975229819 },
2975329820 "ja": {
2975429821 "stringUnit": {
2975529822 "state": "translated",
29756 "value": "幅指定のある表の列を縮小"
29823 "value": "アウトラインを表示(⌥⌘O)"
2975729824 }
2975829825 },
2975929826 "pt-BR": {
2976029827 "stringUnit": {
2976129828 "state": "translated",
29762 "value": "Encolher Colunas da Tabela com Larguras"
29829 "value": "Mostrar a estrutura (⌥⌘O)"
2976329830 }
2976429831 }
2976529832 }
2976629833 },
29767 "Shrink or Expand Table Column": {
29834 "Shown as usual": {
29835 "localizations": {
29836 "de": {
29837 "stringUnit": {
29838 "state": "translated",
29839 "value": "Normal angezeigt"
29840 }
29841 },
29842 "es": {
29843 "stringUnit": {
29844 "state": "translated",
29845 "value": "Se muestran como siempre"
29846 }
29847 },
29848 "fr": {
29849 "stringUnit": {
29850 "state": "translated",
29851 "value": "Affichées normalement"
29852 }
29853 },
29854 "ja": {
29855 "stringUnit": {
29856 "state": "translated",
29857 "value": "通常どおり表示"
29858 }
29859 },
29860 "pt-BR": {
29861 "stringUnit": {
29862 "state": "translated",
29863 "value": "Mostradas normalmente"
29864 }
29865 }
29866 }
29867 },
29868 "Shrink Table Columns with Widths": {
2976829869 "comment": "Command title",
2976929870 "localizations": {
2977029871 "de": {
2977129872 "stringUnit": {
2977229873 "state": "translated",
29773 "value": "Tabellenspalte verkleinern oder erweitern"
29874 "value": "Tabellenspalten mit Breite verkleinern"
2977429875 }
2977529876 },
2977629877 "es": {
2977729878 "stringUnit": {
2977829879 "state": "translated",
29779 "value": "Reducir o expandir columna de la tabla"
29880 "value": "Reducir columnas de la tabla con ancho definido"
2978029881 }
2978129882 },
2978229883 "fr": {
2978329884 "stringUnit": {
2978429885 "state": "translated",
29785 "value": "Réduire ou développer la colonne du tableau"
29886 "value": "Réduire les colonnes du tableau à leur largeur"
2978629887 }
2978729888 },
2978829889 "ja": {
2978929890 "stringUnit": {
2979029891 "state": "translated",
29791 "value": "表の列を縮小/展開"
29892 "value": "幅指定のある表の列を縮小"
2979229893 }
2979329894 },
2979429895 "pt-BR": {
2979529896 "stringUnit": {
2979629897 "state": "translated",
29797 "value": "Encolher ou Expandir Coluna da Tabela"
29898 "value": "Encolher Colunas da Tabela com Larguras"
2979829899 }
2979929900 }
2980029901 }
2980129902 },
29802 "Sidebar": {
29903 "Shrink or Expand Table Column": {
29904 "comment": "Command title",
2980329905 "localizations": {
2980429906 "de": {
2980529907 "stringUnit": {
2980629908 "state": "translated",
29807 "value": "Seitenleiste"
29909 "value": "Tabellenspalte verkleinern oder erweitern"
2980829910 }
2980929911 },
2981029912 "es": {
2981129913 "stringUnit": {
2981229914 "state": "translated",
29813 "value": "Barra lateral"
29915 "value": "Reducir o expandir columna de la tabla"
2981429916 }
2981529917 },
2981629918 "fr": {
2981729919 "stringUnit": {
2981829920 "state": "translated",
29819 "value": "Barre latérale"
29921 "value": "Réduire ou développer la colonne du tableau"
2982029922 }
2982129923 },
2982229924 "ja": {
2982329925 "stringUnit": {
2982429926 "state": "translated",
29825 "value": "サイドバー"
29927 "value": "表の列を縮小/展開"
2982629928 }
2982729929 },
2982829930 "pt-BR": {
2982929931 "stringUnit": {
2983029932 "state": "translated",
29831 "value": "Barra Lateral"
29933 "value": "Encolher ou Expandir Coluna da Tabela"
2983229934 }
2983329935 }
2983429936 }
@@ -31900,40 +32002,6 @@
3190032002 }
3190132003 }
3190232004 },
31903 "The Agenda button at the top of the sidebar shows your agenda, or a view from views.toml, beside the editor.": {
31904 "localizations": {
31905 "de": {
31906 "stringUnit": {
31907 "state": "translated",
31908 "value": "Die Taste „Agenda“ oben in der Seitenleiste zeigt deine Agenda oder eine Ansicht aus views.toml neben dem Editor."
31909 }
31910 },
31911 "es": {
31912 "stringUnit": {
31913 "state": "translated",
31914 "value": "El botón Agenda en la parte superior de la barra lateral muestra tu agenda, o una vista de views.toml, junto al editor."
31915 }
31916 },
31917 "fr": {
31918 "stringUnit": {
31919 "state": "translated",
31920 "value": "Le bouton Agenda en haut de la barre latérale affiche votre agenda, ou une vue de views.toml, à côté de l'éditeur."
31921 }
31922 },
31923 "ja": {
31924 "stringUnit": {
31925 "state": "translated",
31926 "value": "サイドバー上部のアジェンダボタンで、アジェンダまたはviews.tomlのビューをエディタの横に表示します。"
31927 }
31928 },
31929 "pt-BR": {
31930 "stringUnit": {
31931 "state": "translated",
31932 "value": "O botão Agenda no topo da barra lateral mostra sua agenda, ou uma visualização do views.toml, ao lado do editor."
31933 }
31934 }
31935 }
31936 },
3193732005 "The App Store can't be reached right now.": {
3193832006 "localizations": {
3193932007 "de": {
@@ -32138,6 +32206,40 @@
3213832206 }
3213932207 }
3214032208 },
32209 "The calendar button under the sidebar shows your agenda, or a view from views.toml, beside the editor.": {
32210 "localizations": {
32211 "de": {
32212 "stringUnit": {
32213 "state": "translated",
32214 "value": "Die Kalendertaste unter der Seitenleiste zeigt deine Agenda oder eine Ansicht aus views.toml neben dem Editor."
32215 }
32216 },
32217 "es": {
32218 "stringUnit": {
32219 "state": "translated",
32220 "value": "El botón de calendario bajo la barra lateral muestra tu agenda, o una vista de views.toml, junto al editor."
32221 }
32222 },
32223 "fr": {
32224 "stringUnit": {
32225 "state": "translated",
32226 "value": "Le bouton calendrier sous la barre latérale affiche votre agenda, ou une vue de views.toml, à côté de l'éditeur."
32227 }
32228 },
32229 "ja": {
32230 "stringUnit": {
32231 "state": "translated",
32232 "value": "サイドバー下のカレンダーボタンで、アジェンダまたはviews.tomlのビューをエディタの横に表示します。"
32233 }
32234 },
32235 "pt-BR": {
32236 "stringUnit": {
32237 "state": "translated",
32238 "value": "O botão de calendário sob a barra lateral mostra sua agenda, ou uma visualização do views.toml, ao lado do editor."
32239 }
32240 }
32241 }
32242 },
3214132243 "The empty folder is removed from disk and from orgstar.": {
3214232244 "localizations": {
3214332245 "de": {