listless

A simple list app for Apple platforms
Log | Files | Refs | README | LICENSE

commit 9d81e0ddac30910a5663550667ca43b8ae49d19a
parent 17e33f6948955140888c62ac214a3936d4b88fe9
Author: Michael Camilleri <[email protected]>
Date:   Sun,  8 Feb 2026 12:56:46 +0900

Add toolbar

Co-Authored-By: Claude 4.5 Sonnet <[email protected]>

Diffstat:
MListless/Views/TaskListView.swift | 31++++++++++++++++++++++++++++++-
MListlessMac/ListlessMacApp.swift | 1+
2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Listless/Views/TaskListView.swift b/Listless/Views/TaskListView.swift @@ -164,6 +164,35 @@ struct TaskListView: View { // Connect SwiftUI's undo manager to Core Data context for automatic undo/redo managedObjectContext.undoManager = newValue } + .toolbar { + ToolbarItem(placement: .automatic) { + Spacer() + } + + ToolbarItem(placement: .automatic) { + Button { + createTaskAndFocus() + // Trigger focus resolution by setting to nil + focusedField = nil + } label: { + Label("New Task", systemImage: "plus") + } + .help("Create a new task") + } + + ToolbarItem(placement: .automatic) { + Button { + if let currentID = selectedTaskID, + let task = allTasksInDisplayOrder.first(where: { $0.id == currentID }) { + deleteTask(task) + } + } label: { + Label("Delete", systemImage: "trash") + } + .disabled(selectedTaskID == nil) + .help("Delete selected task") + } + } } private var activeTasks: [TaskItem] { @@ -211,7 +240,7 @@ struct TaskListView: View { let task = store.createTask(title: "") // Record intent to focus the new task - // This will be resolved in onChange(of: tasks) after view is created + // This will be resolved in onChange(of: focusedField) when focus becomes nil pendingFocus = .task(task.id) selectedTaskID = task.id } diff --git a/ListlessMac/ListlessMacApp.swift b/ListlessMac/ListlessMacApp.swift @@ -15,5 +15,6 @@ struct ListlessMacApp: App { TaskListView(store: TaskStore(persistenceController: persistenceController)) .environment(\.managedObjectContext, persistenceController.viewContext) } + .windowStyle(.hiddenTitleBar) } }