Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions mac/Sources/Wind/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
}
started = true
statusItem.button?.title = ""
applyMenuBarIcon()
checkSystemZoom()
Log.info("started; binds: " + Action.allCases.map { a in
"\(a)=\((mag.config.binds().binds[a] ?? []).map { $0.description }.joined(separator: "|"))" }.joined(separator: " "))
Expand Down Expand Up @@ -173,6 +174,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
for k in dropped { Log.error("config.json: \"\(k)\" has the wrong type, using the default") }
configInvalid = false
mag.apply(c)
applyMenuBarIcon()
settingsWindow.update(c)
Log.info("config loaded")
} catch {
Expand Down Expand Up @@ -240,6 +242,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
menu.addItem(item("Mouse within edges", #selector(toggleEdge), on: c.mouseAlign == 1))
menu.addItem(.separator())
menu.addItem(item("Open at login", #selector(toggleLogin), on: SMAppService.mainApp.status == .enabled))
menu.addItem(item("Show in menu bar", #selector(hideMenuBarIcon), on: true))
menu.addItem(item("Settings…", #selector(openSettings)))
let more = NSMenu()
more.addItem(item("Edit settings file…", #selector(openConfig)))
Expand Down Expand Up @@ -291,6 +294,21 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
}, fixZoom: { [weak self] in self?.turnOffSystemZoom() }, onboard: onboard)
}

/// The icon shows while Wind lacks Accessibility whatever the setting: it is where Wind says so.
private func applyMenuBarIcon() {
statusItem?.isVisible = mag.config.showMenuBarIcon || !started
}

@objc private func hideMenuBarIcon() {
let a = NSAlert()
a.messageText = "Hide Wind from the menu bar?"
a.informativeText = "Wind keeps running. To show the icon again, open Wind again (from Spotlight or Finder) and turn on Show in menu bar in Settings."
a.addButton(withTitle: "Hide"); a.addButton(withTitle: "Cancel")
NSApp.activate(ignoringOtherApps: true)
guard a.runModal() == .alertFirstButtonReturn else { return }
saveConfig { $0.showMenuBarIcon = false }
}

@objc private func toggleLogin() {
let svc = SMAppService.mainApp
do {
Expand Down
2 changes: 2 additions & 0 deletions mac/Sources/WindCore/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public struct Config: Codable, Equatable {
public var fullPointerSpeed = true

public var logLevel = 1 // 0 = quiet, 1 = sessions, 2 = verbose, 3 = + every zoom write
/// The menu bar icon. Hidden, opening Wind again (Spotlight, Finder) shows Settings, where it comes back.
public var showMenuBarIcon = true

// Settings window (ui/). Read by the page only, except onboarded (AppDelegate.needsSetup).
public var uiPalette = "grey" // the built-in theme: grey, ember, ocean or hicon
Expand Down
1 change: 1 addition & 0 deletions mac/Tests/fixtures/config_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"quit": { "type": "list", "def": "cmd+escape" },
"renderScaling": { "type": "int", "def": "0", "min": 0, "max": 0 },
"showAdvanced": { "type": "bool", "def": "0" },
"showMenuBarIcon": { "type": "bool", "def": "1" },
"slowPanGlide": { "type": "bool", "def": "0" },
"slowPrecision": { "type": "bool", "def": "0" },
"smoothImages": { "type": "bool", "def": "0" },
Expand Down
2 changes: 1 addition & 1 deletion mac/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.9
0.6.0
2 changes: 2 additions & 0 deletions mac/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,8 @@ caret following off. Each Tab must move the view onto the focused button; passes
Spec and plan: `~/Documents/Claude/research/wind-mac/2026-11-01-settings-port-spec-plan.md`.
- **Opening Wind again** while it runs (Spotlight, Finder, `open -a Wind`) opens this window, or the
setup when `needsSetup` holds (`applicationShouldHandleReopen`, 0.5.8).
- **Menu bar icon** (0.6.0): `showMenuBarIcon` (menu item "Show in menu bar", and a Settings row) hides the status
item; Wind keeps running and opening it again shows Settings. It always shows while Accessibility is missing.
- **A normal window while open** (0.5.9): Wind turns into a regular app (Dock icon, Cmd+Tab, moves aside for
Show Desktop) and back to a menu-bar agent when it closes. The page covers the transparent title bar, so
`DragWebView` drags the window from the top 28 px (only while the page sits at the top, reported by `titleBand`)
Expand Down
2 changes: 2 additions & 0 deletions mac/ui/src/settings-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export const groups = [
desc: 'They fight Wind for the zoom when they are on', on: 'Off', off: 'On', btn: 'Turn off', action: 'fixZoomShortcuts' },
{ key: '__loginItem', type: 'macstatus', status: 'loginItem', toggle: true, label: 'Open at login', keywords: ['startup', 'start up', 'launch', 'boot', 'login items', 'autostart', 'automatically', 'sign in', 'background'],
desc: 'Starts Wind when you log in', action: 'setLogin' },
{ key: 'showMenuBarIcon', type: 'toggle', label: 'Show in menu bar', keywords: ['menu bar', 'menubar', 'status bar', 'status item', 'icon', 'tray', 'hide', 'show', 'top bar', 'magnifying glass'],
desc: 'When hidden, open Wind again from Spotlight or Finder to get here', def: 1 },
{ key: 'logLevel', type: 'select', label: 'Log detail', keywords: ['log', 'logging', 'verbose', 'debug', 'diagnostics', 'trace', 'quiet', 'file', 'troubleshoot'],
desc: 'How much Wind writes to its log', options: ['0', '1', '2', '3'], optionLabels: { '0': 'Quiet', '1': 'Sessions', '2': 'Verbose', '3': 'Every zoom step' }, def: '1' },
{ key: '__showLog', type: 'button', label: 'Show log', keywords: ['log', 'logs', 'console', 'debug', 'troubleshoot', 'problem', 'file', 'history'],
Expand Down
2 changes: 1 addition & 1 deletion mac/ui/tests/prefs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ test('General holds the theme, the screenshot and advanced switches; the macOS c
await go(page, 'prefs');
const keys = await page.locator('main .row').evaluateAll((rs) => rs.map((r) => r.getAttribute('data-key')));
expect(keys).toEqual(['uiPalette', 'ownScreenshot', 'showAdvanced', 'warmthPct', 'dimPct', '__accessibility', '__screenRecording',
'__zoomShortcuts', '__loginItem', 'logLevel', '__showLog', '__openIni', '__diagnostics', '__rerunSetup']);
'__zoomShortcuts', '__loginItem', 'showMenuBarIcon', 'logLevel', '__showLog', '__openIni', '__diagnostics', '__rerunSetup']);
});
4 changes: 2 additions & 2 deletions mac/ui/tests/schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ test('the engine select: Render, Backdrop or Transform (default), in the Engine
expect(schemaDefaults().engine).toBe('zoom');
});

test('the macOS card: status rows, the login switch, log detail and four buttons', () => {
test('the macOS card: status rows, the login and menu bar switches, log detail and four buttons', () => {
const prefs = groups.find((g) => g.id === 'prefs');
const mac = prefs.cards.find((c) => c.caption === 'macOS');
expect(mac.rows.map((r) => [r.key, r.type])).toEqual([
['__accessibility', 'macstatus'], ['__screenRecording', 'macstatus'], ['__zoomShortcuts', 'macstatus'],
['__loginItem', 'macstatus'], ['logLevel', 'select'],
['__loginItem', 'macstatus'], ['showMenuBarIcon', 'toggle'], ['logLevel', 'select'],
['__showLog', 'button'], ['__openIni', 'button'], ['__diagnostics', 'button'], ['__rerunSetup', 'button'],
]);
const act = Object.fromEntries(mac.rows.map((r) => [r.key, r.action]));
Expand Down
Loading