Commit b67875bcfa

b67875bcfa3f7eaf54229407d27590d38152bfcf

parent: eee69add63

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-25 22:15 UTC

Mac: add folders by dropping them on the sidebar

Folders dragged from the Finder onto the sidebar are added as
Add Folder… adds them; the sidebar is outlined while a drag is over it.

Ref #222

Layout: unified · split

Changed files (2)
Sources/Orgstar/Sidebar.swift +16 · view
@@ -14,6 +14,8 @@ struct Sidebar: View {
1414 /// Folders shown collapsed, by path, one per line.
1515 @AppStorage("collapsedFolders") private var collapsedText = ""
1616 @State private var removing: String?
17 /// A drag with a folder is over the sidebar.
18 @State private var dropTargeted = false
1719 /// A file operation waiting for a name or a confirmation.
1820 @Environment(\.orgTheme) private var theme
1921 @Environment(\.colorScheme) private var colorScheme
@@ -75,6 +77,20 @@ struct Sidebar: View {
7577 }
7678 .listStyle(.sidebar)
7779 .themedListBackground(theme.color("sidebar-background", in: colorScheme))
80 // Folders dropped from the Finder are added as Add Folder… adds them.
81 .dropDestination(for: URL.self) { urls, _ in
82 let folders = urls.filter { (try? $0.resourceValues(forKeys: [.isDirectoryKey]).isDirectory) == true }
83 guard !folders.isEmpty else { return false }
84 Task {
85 for folder in folders {
86 do { try await workspace.addRoot(folder) } catch { workspace.lastError = error.localizedDescription }
87 }
88 }
89 return true
90 } isTargeted: { dropTargeted = $0 }
91 .overlay {
92 if dropTargeted { RoundedRectangle(cornerRadius: 6).strokeBorder(Color.accentColor, lineWidth: 2).padding(2) }
93 }
7894 .safeAreaInset(edge: .bottom, spacing: 0) {
7995 SidebarBar(showsAgenda: $showsAgenda) {
8096 Button("Add Folder…", systemImage: "plus", action: addFolder)
docs/manual/guide/01-files-and-folders.org +1 −1 · view
@@ -48,7 +48,7 @@ orgstar does not open a single folder like a project. You add any number of fold
4848
4949** Adding a folder
5050
51Choose File ▸ Add Folder… (=⇧⌘O=), or click =+= at the bottom of the sidebar, and pick a folder. The first time orgstar opens with no folder, a welcome sheet offers the same, or a new =org= folder in iCloud Drive with a =notes.org= in it (in the Mac App Store version, a folder you choose or make in iCloud Drive), and the choice of keys; Get Started… in the empty window opens the sheet again. orgstar indexes it in the background; the toolbar shows a progress indicator while it works.
51Choose File ▸ Add Folder… (=⇧⌘O=), or click =+= at the bottom of the sidebar, and pick a folder. You can also drag folders from the Finder onto the sidebar. The first time orgstar opens with no folder, a welcome sheet offers the same, or a new =org= folder in iCloud Drive with a =notes.org= in it (in the Mac App Store version, a folder you choose or make in iCloud Drive), and the choice of keys; Get Started… in the empty window opens the sheet again. orgstar indexes it in the background; the toolbar shows a progress indicator while it works.
5252
5353orgstar keeps a bookmark to each folder, so a folder you move or rename in Finder is followed. If a folder can't be found at launch, orgstar reports =Can't find the folder PATH.= Adding a folder that is already in the sidebar does nothing.
5454
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form