listless

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

commit ea40cd889a49660810e5763e530259bfb54c15e0
parent 548dd3180490b2c7154f42c578c5cad44883943e
Author: Michael Camilleri <[email protected]>
Date:   Thu,  5 Mar 2026 10:26:31 +0900

Tweak macOS window settings

This commit uses the row's accent colour to stroke the selected active
row. It also adjusts some of the spacing and ensures that the window is
listed in the Window menu.

Co-Authored-By: Codex GPT 5.3 <[email protected]>

Diffstat:
MListlessMac/ListlessMacApp.swift | 26+++++++++++++++++++++++++-
MListlessMac/Views/TaskRowView.swift | 3++-
2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/ListlessMac/ListlessMacApp.swift b/ListlessMac/ListlessMacApp.swift @@ -120,18 +120,42 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation { defer: false ) window.contentViewController = NSHostingController(rootView: rootView) + window.title = "Items" window.setContentSize(defaultContentSize) window.minSize = NSSize(width: 320, height: 240) window.titleVisibility = .hidden window.titlebarAppearsTransparent = true window.isReleasedWhenClosed = false window.isRestorable = false - window.center() + let referenceWindow = NSApp.orderedWindows.first { existingWindow in + existingWindow.isVisible && existingWindow.title == "Items" + } + position(window, relativeTo: referenceWindow) window.makeKeyAndOrderFront(nil) window.makeFirstResponder(nil) NSApp.activate() } + private func position(_ window: NSWindow, relativeTo referenceWindow: NSWindow?) { + guard let referenceWindow else { + window.center() + return + } + + let offset: CGFloat = 28 + var origin = NSPoint( + x: referenceWindow.frame.origin.x + offset, + y: referenceWindow.frame.origin.y - offset + ) + + if let visibleFrame = referenceWindow.screen?.visibleFrame ?? NSScreen.main?.visibleFrame { + origin.x = min(max(origin.x, visibleFrame.minX), visibleFrame.maxX - window.frame.width) + origin.y = min(max(origin.y, visibleFrame.minY), visibleFrame.maxY - window.frame.height) + } + + window.setFrameOrigin(origin) + } + private func openSyncDiagnosticsWindow() { if let window = syncDiagnosticsWindow { window.makeKeyAndOrderFront(nil) diff --git a/ListlessMac/Views/TaskRowView.swift b/ListlessMac/Views/TaskRowView.swift @@ -101,6 +101,7 @@ struct TaskRowView: View { .accessibilityIdentifier( isCurrentlyEditing ? "task-textfield" : "task-text-\(task.title)") } + .padding(.top, 4) .padding(.vertical, 8) .padding(.horizontal, 16) .frame(maxWidth: .infinity, alignment: .leading) @@ -186,7 +187,7 @@ struct TaskRowView: View { isSelected ? Color(nsColor: .controlBackgroundColor) : Color(nsColor: .windowBackgroundColor) } else if isSelected { RoundedRectangle(cornerRadius: 6, style: .continuous) - .fill(cachedAccentColor.opacity(0.10)) + .fill(Color(nsColor: .controlBackgroundColor)) } }