diff --git a/CHANGELOG.md b/CHANGELOG.md index 5550e8f3..6d818c4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,15 @@ - "Automatically hide icon after" and its delay are one "Hide icons again" popup with a Never choice. - About shows which build you run, links the changelog, and (direct build) has Check for Updates. X replaces Twitter. +### macOS 27 (direct build) +- Pinned sections (beta, on by default): each app keeps the section you gave it when it restarts, instead of falling into the hidden section where macOS puts a relaunched icon. Apps seen for the first time start visible. Settings › Menu Bar Apps lists your menu-bar apps with a section choice per app and "Reset all to visible" (#366, #334, #107). +- Apps set to always hidden stay hidden when the bar expands (#224). +- Menu-bar apps without a Dock icon are now noticed when they start, so they get their section back too. + +### macOS 26 and earlier +- The always-hidden section stays hidden when the bar expands; Option-click shows it until the next collapse (#224). +- "Show Everything" in the arrow's right-click menu shows the always-hidden section to recover icons lost there (#242). + ## v1.11.2 (2026-11-15) Mostly macOS 27 fixes for the direct download build, plus auto-update. Thanks to everyone whose pull requests went into this release: @lllyt8, @bhaveshnigam, @Shigo-45, @kwvg, @renovys, @goosefraba, @DanishjeetSingh, @khallmark, @richarddemann, @antib0t, @Metekilic, @voltangle and @gmcinalli. diff --git a/Hidden Bar.xcodeproj/project.pbxproj b/Hidden Bar.xcodeproj/project.pbxproj index 9db9402f..d54e7aea 100644 --- a/Hidden Bar.xcodeproj/project.pbxproj +++ b/Hidden Bar.xcodeproj/project.pbxproj @@ -130,6 +130,8 @@ D3F13FAFD4676A6D14884887 /* SelectedSecond.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08A5F85B23AA013100981CA5 /* SelectedSecond.swift */; }; D44900914DCA23195B7C7843 /* HyperlinkTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C20FDD23AABDD10035D978 /* HyperlinkTextField.swift */; }; D61D23037A1EB8F7DD848EA4 /* AdvancedSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13F6B1FCE2F0F29887382BF5 /* AdvancedSettingsViewController.swift */; }; + 837108CD16BDBEB2B6A4B064 /* MenuBarAppsSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */; }; + 142B73DAE4B1D30D0775D310 /* MenuBarAppsSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */; }; D62C67552025B67BCCE48642 /* SettingsModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60AFBE8D4C25548192E7D135 /* SettingsModelTests.swift */; }; D66609979150D0030CBE89E0 /* MenuBarEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DDBB306F3907BFB2D9E6DCF /* MenuBarEngine.swift */; }; E191D3FECED22D5FF5B8AD46 /* SettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A559ED44CB2BAC9DAE646EE7 /* SettingsModel.swift */; }; @@ -183,6 +185,7 @@ 08C20FE123AB452C0035D978 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = ""; }; 092D9DE26A006349D87B304D /* MenuBarLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarLayout.swift; sourceTree = ""; }; 1218DDCA0B5E85481E4F8F3B /* SettingsWindowTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SettingsWindowTests.swift; sourceTree = ""; }; + 9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MenuBarAppsSettingsViewController.swift; sourceTree = ""; }; 13F6B1FCE2F0F29887382BF5 /* AdvancedSettingsViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsViewController.swift; sourceTree = ""; }; 15C9D233ED7802C9AB5C7240 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = ""; }; 1AE90FC41D6BE7A8B6C61303 /* SettingsViews.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SettingsViews.swift; sourceTree = ""; }; @@ -429,6 +432,7 @@ 1AE90FC41D6BE7A8B6C61303 /* SettingsViews.swift */, 1FBC806D51AA2E70183A5308 /* AppearanceSettingsViewController.swift */, 13F6B1FCE2F0F29887382BF5 /* AdvancedSettingsViewController.swift */, + 9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */, 22AF1A1AA5ABA4C7881D1682 /* SettingsSnapshot.swift */, ); name = Settings; @@ -790,6 +794,7 @@ CD55D62C6EB16728FDE6E311 /* SettingsViews.swift in Sources */, 0BDB4054A4822D299F534B34 /* AppearanceSettingsViewController.swift in Sources */, FEDF14D1A5762D05124A8462 /* AdvancedSettingsViewController.swift in Sources */, + 837108CD16BDBEB2B6A4B064 /* MenuBarAppsSettingsViewController.swift in Sources */, E200010F880C7CE35022B50A /* SettingsSnapshot.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -858,6 +863,7 @@ 1E55107E50681D0C905D60F6 /* SettingsViews.swift in Sources */, 7C149D7BC182147B87C08982 /* AppearanceSettingsViewController.swift in Sources */, D61D23037A1EB8F7DD848EA4 /* AdvancedSettingsViewController.swift in Sources */, + 142B73DAE4B1D30D0775D310 /* MenuBarAppsSettingsViewController.swift in Sources */, A3B15C1FDF934AFBADF438B6 /* SettingsSnapshot.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/HiddenBarTests/MenuBarEngineTests.swift b/HiddenBarTests/MenuBarEngineTests.swift index c64e842e..c95b472b 100644 --- a/HiddenBarTests/MenuBarEngineTests.swift +++ b/HiddenBarTests/MenuBarEngineTests.swift @@ -1502,6 +1502,29 @@ final class AppsLaunchedWhileHidingTests: XCTestCase { XCTAssertEqual(visibility.requests.count, 1) } + // Beta off: agent apps (no Dock icon, most menu-bar apps) are reported too, + // so one that starts while collapsed is shown, as 1.11.2 meant to. + func testWithPinnedSectionsOffAgentStartsAreStillReported() { + XCTAssertTrue(AgentLaunchNotifications.isActive(pinnedSectionsEnabled: false)) + XCTAssertTrue(AgentLaunchNotifications.isActive(pinnedSectionsEnabled: true)) + + let agents = NotificationCenter() + let items = self.items! + let engine = NativeVisibilityEngine(items: items, inventory: inventory, visibility: visibility, clock: FakeClock(), + ownBundleIdentifier: own, + itemFrame: { $0 === items.toggleItem ? separator : alwaysHiddenSeparator }, + displays: { [mainDisplay] }, isLTR: { true }, + sectionMemory: memory, agentLaunches: agents) + _ = collapsed(engine) + let app = try! XCTUnwrap(NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.dock").first) + agents.post(name: NSWorkspace.didLaunchApplicationNotification, object: nil, + userInfo: [NSWorkspace.applicationUserInfoKey: app]) + let delivered = expectation(description: "delivered on the main queue") + DispatchQueue.main.async { delivered.fulfill() } + wait(for: [delivered], timeout: 2) + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.apple.dock", "com.visible"]) + } + func testHiddenBarAndMacOSItemOwnersAreLeftAlone() { let engine = makeEngine() _ = collapsed(engine) @@ -1531,6 +1554,313 @@ final class AppsLaunchedWhileHidingTests: XCTestCase { } } +// MARK: - Pinned sections (#366, beta) + +final class PinnedSectionsTests: XCTestCase { + private let own = "com.dwarvesv.minimalbar" + private var items: FakeItems! + private var inventory: FakeInventory! + private var visibility: FakeVisibility! + private var observed: InMemorySectionMemory! + private var table: InMemorySectionMemory! + private var pins = true + + override func setUp() { + super.setUp() + items = FakeItems() + inventory = FakeInventory() + inventory.items = [item("com.always", x: 900), item("com.hidden", x: 1100), item("com.visible", x: 1400)] + visibility = FakeVisibility() + observed = InMemorySectionMemory() + table = InMemorySectionMemory() + pins = true + } + + private func makeEngine() -> NativeVisibilityEngine { + let items = self.items! + return NativeVisibilityEngine(items: items, inventory: inventory, visibility: visibility, clock: FakeClock(), + ownBundleIdentifier: own, + itemFrame: { $0 === items.toggleItem ? separator : alwaysHiddenSeparator }, + displays: { [mainDisplay] }, + isLTR: { true }, + sectionMemory: observed, + pinnedSections: table, + pinsSections: { [unowned self] in pins }) + } + + @discardableResult + private func collapse(_ engine: NativeVisibilityEngine) -> [String] { + engine.collapse { _ in } + visibility.succeed(visibility.requests.count - 1) + return visibility.requests.last?.bundles ?? [] + } + + private func move(_ bundle: String, to x: CGFloat) { + inventory.items = inventory.items.filter { $0.bundleIdentifier != bundle } + [item(bundle, x: x)] + } + + // Given an app the user keeps visible + // When it relaunches while the bar is collapsed and macOS puts its icon far left + // Then the next collapse keeps it visible and the table is unchanged + func testARelaunchedAppKeepsItsSectionWhereverMacOSPutsItsIcon() { + let engine = makeEngine() + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + engine.applicationLaunched("com.visible") + engine.expand() + move("com.visible", to: 1150) + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + XCTAssertEqual(table.sections["com.visible"], .visible) + XCTAssertEqual(engine.state, .collapsed) + + // Later collapses with the icon still there keep it visible too. + engine.expand() + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + } + + // Without the beta, the same relaunch hides the app (v1.11.2, the drift #366 is about). + func testWithTheBetaOffARelaunchedAppGoesWhereMacOSPutsIt() { + pins = false + table.sections = ["com.visible": .visible] + let engine = makeEngine() + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + engine.applicationLaunched("com.visible") + engine.expand() + move("com.visible", to: 1150) + XCTAssertEqual(collapse(engine), [own]) + XCTAssertEqual(table.sections, ["com.visible": .visible], "the table is not touched while the beta is off") + XCTAssertEqual(observed.sections["com.visible"], .hidden) + } + + func testADragOfAnAppThatDidNotRelaunchEditsTheTable() { + let engine = makeEngine() + collapse(engine) + engine.expand() + move("com.hidden", to: 1450) + XCTAssertEqual(collapse(engine), [own, "com.hidden", "com.visible"]) + XCTAssertEqual(table.sections["com.hidden"], .visible) + + engine.expand() + move("com.visible", to: 1120) + XCTAssertEqual(collapse(engine), [own, "com.hidden"]) + XCTAssertEqual(table.sections["com.visible"], .hidden) + } + + // Given an app Hidden Bar has never seen + // When it starts and macOS puts its icon on the hidden side + // Then it is shown, and stays shown on later reads of the same position + func testANeverSeenAppStartsVisibleAndStaysVisible() { + let engine = makeEngine() + collapse(engine) + engine.applicationLaunched("com.new") + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.new", "com.visible"], "shown at once") + visibility.succeed(visibility.requests.count - 1) + XCTAssertNil(table.sections["com.new"], "an app without an icon in a read is not added") + + engine.expand() + inventory.items.append(item("com.new", x: 1150)) + XCTAssertEqual(collapse(engine), [own, "com.new", "com.visible"]) + XCTAssertEqual(table.sections["com.new"], .visible) + + engine.expand() + XCTAssertEqual(collapse(engine), [own, "com.new", "com.visible"], "an unchanged position is not a drag") + } + + func testAppsAlreadyRunningWithNoTableEntryTakeTheirPosition() { + let engine = makeEngine() + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + XCTAssertEqual(table.sections, ["com.always": .hidden, "com.hidden": .hidden, "com.visible": .visible]) + } + + // A Preferences edit is not undone by the next read, though the icon did not move. + func testAPreferencesEditOutlivesTheNextRead() { + let engine = makeEngine() + collapse(engine) + PinnedSectionEdits.set(.hidden, for: "com.visible", in: table) + engine.pinnedSectionsDidChange() + XCTAssertEqual(visibility.requests.last?.bundles, [own], "applied at once") + visibility.succeed(visibility.requests.count - 1) + + engine.expand() + XCTAssertEqual(collapse(engine), [own]) + XCTAssertEqual(table.sections["com.visible"], .hidden) + } + + func testResetAllToVisibleShowsEveryAppWithoutARelaunch() { + table.sections = ["com.always": .alwaysHidden, "com.hidden": .hidden, "com.visible": .visible, "com.gone": .hidden] + let engine = makeEngine() + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + PinnedSectionEdits.resetAllToVisible(in: table) + engine.pinnedSectionsDidChange() + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.always", "com.hidden", "com.visible"]) + visibility.succeed(visibility.requests.count - 1) + XCTAssertEqual(engine.state, .collapsed) + XCTAssertEqual(Set(table.sections.values), [.visible]) + XCTAssertEqual(table.sections.count, 4, "apps not running are reset too") + } + + func testAnAppThatStartsWhileHidingGetsItsPinnedSection() { + table.sections = ["com.later": .visible, "com.later-hidden": .hidden] + observed.sections = ["com.later": .hidden] + let engine = makeEngine() + collapse(engine) + engine.applicationLaunched("com.later-hidden") + XCTAssertEqual(visibility.requests.count, 1, "kept hidden") + engine.applicationLaunched("com.later") + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.later", "com.visible"], "the table wins over the last read") + } + + func testEditsAreIgnoredWhileTheBetaIsOff() { + pins = false + let engine = makeEngine() + collapse(engine) + table.sections["com.visible"] = .hidden + engine.pinnedSectionsDidChange() + XCTAssertEqual(visibility.requests.count, 1) + } + + func testTheTableStartsFromTheLastReadSections() throws { + let suite = "HiddenBarTests.pinnedSections.\(UUID().uuidString)" + let defaults = try XCTUnwrap(UserDefaults(suiteName: suite)) + defer { defaults.removePersistentDomain(forName: suite) } + UserDefaultsSectionMemory(defaults: defaults).sections = ["com.a": .hidden, "com.b": .alwaysHidden] + let pinned = UserDefaultsPinnedSections(defaults: defaults) + XCTAssertEqual(pinned.sections, ["com.a": .hidden, "com.b": .alwaysHidden]) + XCTAssertNil(defaults.object(forKey: UserDefaultsPinnedSections.key), "seeding writes nothing") + + pinned.sections["com.a"] = .visible + UserDefaultsSectionMemory(defaults: defaults).sections = ["com.a": .alwaysHidden] + XCTAssertEqual(UserDefaultsPinnedSections(defaults: defaults).sections, ["com.a": .visible, "com.b": .alwaysHidden], + "once written, the table no longer follows the reads") + } + + // #224 on 27: given an app set always-hidden in Preferences, with no + // always-hidden separator, when the bar expands, then it stays hidden. + func testAnAlwaysHiddenAppStaysHiddenWhileExpandedWithoutTheSeparator() { + table.sections = ["com.hidden": .alwaysHidden] + let engine = makeEngine() + XCTAssertTrue(engine.separatorsHiddenForCollapse(current: false), "every collapse hides the section again") + engine.updateAlwaysHiddenSection(enabled: false, separatorHidden: true) + XCTAssertEqual(collapse(engine), [own, "com.visible"]) + + engine.expand() + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.always", "com.visible"]) + visibility.succeed(visibility.requests.count - 1) + XCTAssertEqual(engine.state, .expanded) + XCTAssertFalse(items.alwaysHiddenItem?.isVisible ?? true) + } + + // Without the beta: v1.11.2 reveals everything on expand unless the + // always-hidden separator is enabled and hidden. + func testWithTheBetaOffAnExpandWithoutTheSeparatorRevealsEverything() { + pins = false + table.sections = ["com.hidden": .alwaysHidden] + let engine = makeEngine() + XCTAssertFalse(engine.separatorsHiddenForCollapse(current: false)) + XCTAssertTrue(engine.separatorsHiddenForCollapse(current: true)) + engine.updateAlwaysHiddenSection(enabled: false, separatorHidden: true) + XCTAssertTrue(visibility.requests.isEmpty) + engine.collapse { _ in } + let collapsed = visibility.succeed(visibility.requests.count - 1) + let count = visibility.requests.count + engine.expand() + XCTAssertEqual(visibility.requests.count, count, "no restriction while expanded") + XCTAssertTrue(collapsed.isInvalidated) + } + + // Option-click shows the section until the next collapse; that collapse + // hides it again from a fresh read, so ⌘-drags made meanwhile count. + func testOptionClickRevealsTheSectionUntilTheNextCollapse() { + table.sections = ["com.hidden": .alwaysHidden] + let engine = makeEngine() + engine.updateAlwaysHiddenSection(enabled: true, separatorHidden: true) + collapse(engine) + engine.expand() + let held = visibility.succeed(visibility.requests.count - 1) + + engine.updateAlwaysHiddenSection(enabled: true, separatorHidden: false) + XCTAssertTrue(held.isInvalidated, "everything shows") + XCTAssertTrue(items.alwaysHiddenItem?.isVisible ?? false, "the separator shows to be dragged") + + move("com.always", to: 1450) + let reads = inventory.snapshots + engine.updateAlwaysHiddenSection(enabled: true, separatorHidden: true) + XCTAssertGreaterThan(inventory.snapshots, reads, "read from the unrestricted bar") + XCTAssertEqual(table.sections["com.always"], .visible) + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.always", "com.visible"]) + } + + func testAPreferencesEditToAlwaysHiddenHidesItOnTheExpandedBarAtOnce() { + let engine = makeEngine() + engine.updateAlwaysHiddenSection(enabled: false, separatorHidden: true) + collapse(engine) + engine.expand() + XCTAssertEqual(visibility.requests.count, 1, "nothing to keep hidden yet") + + PinnedSectionEdits.set(.alwaysHidden, for: "com.visible", in: table) + engine.pinnedSectionsDidChange() + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.always", "com.hidden"]) + visibility.succeed(visibility.requests.count - 1) + + PinnedSectionEdits.resetAllToVisible(in: table) + engine.pinnedSectionsDidChange() + XCTAssertEqual(visibility.requests.count, 2, "nothing left to hide: the restriction is dropped") + XCTAssertEqual(engine.state, .expanded) + } + + func testTheListShowsEveryTableAppByName() { + let entries = PinnedSectionsList.entries( + table: ["com.b": .hidden, "com.a": .visible, "com.gone": .alwaysHidden, "com.apple.controlcenter": .visible], + name: { ["com.a": "zeta", "com.b": "Alpha"][$0] }) + XCTAssertEqual(entries.map(\.bundle), ["com.b", "com.gone", "com.apple.controlcenter", "com.a"]) + XCTAssertEqual(entries.map(\.section), [.hidden, .alwaysHidden, .visible, .visible]) + XCTAssertEqual(entries[1].name, "com.gone", "an uninstalled app is listed by bundle id") + } + + // Most menu-bar apps are agents, whose starts NSWorkspace does not post. + func testAgentStartsAndQuitsAreReportedAndDockAppsAreLeftToNSWorkspace() { + let agent = { (name: String) in name.hasPrefix("agent") } + let started = AgentLaunchNotifications.notifications(kind: .insertion, inserted: ["agent.a", "dock.b"], removed: [], isAgent: agent) + XCTAssertEqual(started.map(\.0), [NSWorkspace.didLaunchApplicationNotification]) + XCTAssertEqual(started.map(\.1), ["agent.a"]) + let quit = AgentLaunchNotifications.notifications(kind: .removal, inserted: [], removed: ["dock.b", "agent.c"], isAgent: agent) + XCTAssertEqual(quit.map(\.0), [NSWorkspace.didTerminateApplicationNotification]) + XCTAssertEqual(quit.map(\.1), ["agent.c"]) + XCTAssertTrue(AgentLaunchNotifications.notifications(kind: .setting, inserted: ["agent.a"], removed: [], isAgent: agent).isEmpty) + } + + func testAnAgentStartReachesTheEngineThroughItsOwnCenter() { + let agents = NotificationCenter() + let items = self.items! + let engine = NativeVisibilityEngine(items: items, inventory: inventory, visibility: visibility, clock: FakeClock(), + ownBundleIdentifier: own, + itemFrame: { $0 === items.toggleItem ? separator : alwaysHiddenSeparator }, + displays: { [mainDisplay] }, isLTR: { true }, + sectionMemory: observed, pinnedSections: table, + pinsSections: { true }, agentLaunches: agents) + collapse(engine) + // Any running app with a bundle id stands in for the agent; the Dock always runs. + let app = try! XCTUnwrap(NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.dock").first) + agents.post(name: NSWorkspace.didLaunchApplicationNotification, object: nil, + userInfo: [NSWorkspace.applicationUserInfoKey: app]) + let expectation = expectation(description: "delivered on the main queue") + DispatchQueue.main.async { expectation.fulfill() } + wait(for: [expectation], timeout: 2) + XCTAssertEqual(visibility.requests.count, 2) + XCTAssertEqual(visibility.requests.last?.bundles, [own, "com.apple.dock", "com.visible"]) + } + + func testResolverRules() { + var observed: [String: MenuBarSection] = ["moved": .hidden, "still": .hidden, "relaunched": .visible] + var table: [String: MenuBarSection] = ["moved": .hidden, "still": .visible, "relaunched": .visible] + let resolved = PinnedSectionResolver.resolve( + read: ["moved": .visible, "still": .hidden, "relaunched": .hidden, "new": .hidden, "running": .alwaysHidden], + launchedSinceRead: ["relaunched", "new"], observed: &observed, table: &table) + XCTAssertEqual(resolved, ["moved": .visible, "still": .visible, "relaunched": .visible, "new": .visible, "running": .alwaysHidden]) + XCTAssertEqual(table, resolved) + XCTAssertEqual(observed, ["moved": .visible, "still": .hidden, "relaunched": .hidden, "new": .hidden, "running": .alwaysHidden]) + } +} + // MARK: - Legacy engine // macOS 27 hides the allowed icons of an app it does not know by bundle id @@ -1687,6 +2017,57 @@ final class LegacyLengthEngineTests: XCTestCase { } } +// MARK: - Legacy recovery patches (#224, #242) + +final class LegacyRecoveryPatchTests: XCTestCase { + // Given macOS 26 and the always-hidden section shown (the default after enabling it) + // When the bar collapses + // Then the collapse hides the section again, so the next expand keeps it hidden + func testEveryCollapseHidesTheAlwaysHiddenSectionAgainUpToMacOS26() { + for os in [13, 15, 26] { + let engine = LegacyLengthEngine(items: FakeItems(), osMajorVersion: os) + XCTAssertTrue(engine.separatorsHiddenForCollapse(current: false), "macOS \(os)") + XCTAssertTrue(engine.separatorsHiddenForCollapse(current: true), "macOS \(os)") + } + } + + func testTheArrowMenuOffersShowEverythingUpToMacOS26() { + XCTAssertTrue(LegacyLengthEngine(items: FakeItems(), osMajorVersion: 26).offersShowEverything) + XCTAssertTrue(LegacyLengthEngine(items: FakeItems(), osMajorVersion: 13).offersShowEverything) + } + + // The App Store build runs this engine on 27 too; nothing changes there. + func testNothingChangesOnMacOS27() { + let engine = LegacyLengthEngine(items: FakeItems(), osMajorVersion: 27) + XCTAssertFalse(engine.separatorsHiddenForCollapse(current: false)) + XCTAssertTrue(engine.separatorsHiddenForCollapse(current: true)) + XCTAssertFalse(engine.offersShowEverything) + } + + func testTheNativeEngineOffersNoShowEverything() { + let native = NativeVisibilityEngine(items: FakeItems(), inventory: FakeInventory(), visibility: FakeVisibility(), clock: FakeClock()) + XCTAssertFalse(native.offersShowEverything) + XCTAssertFalse(native.separatorsHiddenForCollapse(current: false), "beta off: unchanged") + } + + // What the controller does on macOS 26 around a collapse, applied to the + // engine: the section is shown (revealed), the collapse hides it again, + // and the next expand keeps it hidden while the rest shows. + func testARevealLastsOnlyUntilTheNextCollapse() { + let items = FakeItems() + let engine = LegacyLengthEngine(items: items, screenWidths: { [1000] }, osMajorVersion: 26) + engine.updateAlwaysHiddenSection(enabled: true, separatorHidden: false) + XCTAssertEqual(items.alwaysHiddenItem?.length, 20, "revealed") + + let separatorsHidden = engine.separatorsHiddenForCollapse(current: false) + engine.updateAlwaysHiddenSection(enabled: true, separatorHidden: separatorsHidden) + engine.collapse { _ in } + engine.expand() + XCTAssertEqual(items.separatorItem.length, 20, "the hidden section shows") + XCTAssertEqual(items.alwaysHiddenItem?.length, 2000, "the always-hidden section stays hidden") + } +} + // MARK: - Arrangement order (#336, PR #381) final class MenuBarOrderTests: XCTestCase { diff --git a/HiddenTests/AppStoreMigrationTests.swift b/HiddenTests/AppStoreMigrationTests.swift index 987b726f..6e070216 100644 --- a/HiddenTests/AppStoreMigrationTests.swift +++ b/HiddenTests/AppStoreMigrationTests.swift @@ -94,6 +94,7 @@ final class AppStoreMigrationTests: XCTestCase { UserDefaults.Key.alwaysHiddenSectionEnabled, UserDefaults.Key.useFullStatusBarOnExpandEnabled, UserDefaults.Key.stealthExpandIconEnabled, UserDefaults.Key.arrowStyle, UserDefaults.Key.hoverToExpand, UserDefaults.Key.notchOverflowEnabled, UserDefaults.Key.pauseHidingForUnkeepableItems, + UserDefaults.Key.pinnedSectionsEnabled, UserDefaultsPinnedSections.key, ] XCTAssertEqual(Set(AppStoreSettingsImport.importableKeys.keys), appKeys) } diff --git a/HiddenTests/SettingsWindowTests.swift b/HiddenTests/SettingsWindowTests.swift index 2740612a..e6c4b747 100644 --- a/HiddenTests/SettingsWindowTests.swift +++ b/HiddenTests/SettingsWindowTests.swift @@ -29,12 +29,14 @@ final class SettingsWindowTests: XCTestCase { UserDefaults.Key.notchOverflowEnabled, // Enable Notch Overflow (notch Macs) UserDefaults.Key.pauseHidingForUnkeepableItems, // macOS 27 direct only UserDefaults.Key.showWholeBarWhenCaptureStarts, // macOS 27 direct only + UserDefaults.Key.pinnedSectionsEnabled, // Pinned sections (beta), macOS 27 direct only "SUEnableAutomaticChecks", // Sparkle, direct only ] static let legacyOtherKeys = [ UserDefaults.Key.isAutoHide, UserDefaults.Key.numberOfSecondForAutoHide, // checkbox + delay popup UserDefaults.Key.arrowStyle, // arrow style popup UserDefaults.Key.globalKey, // global shortcut + UserDefaultsPinnedSections.key, // Menu Bar Apps section popups (beta) ] private var saved: [String: Any] = [:] @@ -44,6 +46,8 @@ final class SettingsWindowTests: XCTestCase { for key in Self.legacyBoolKeys + Self.legacyOtherKeys { saved[key] = UserDefaults.standard.object(forKey: key) } + // The app registers the pane at launch; each test decides. + MenuBarAppsPane.makeViewController = nil } override func tearDown() { @@ -180,7 +184,8 @@ final class SettingsWindowTests: XCTestCase { var context = fullContext() context.build = .appStore let views = allViews(PreferencesWindowController(context: context)) - for key in [UserDefaults.Key.pauseHidingForUnkeepableItems, UserDefaults.Key.showWholeBarWhenCaptureStarts, "SUEnableAutomaticChecks"] { + for key in [UserDefaults.Key.pauseHidingForUnkeepableItems, UserDefaults.Key.showWholeBarWhenCaptureStarts, + UserDefaults.Key.pinnedSectionsEnabled, "SUEnableAutomaticChecks"] { XCTAssertNil(control(key, in: views), "\(key) shows in the App Store build") } XCTAssertNil(control(AboutViewController.checkForUpdatesIdentifier.rawValue, in: views)) @@ -208,6 +213,50 @@ final class SettingsWindowTests: XCTestCase { controller.tabs.map { $0.titleKey.localized }) } + // Given the pinned sections beta with two known apps + // When picking a section in an app's popup, then clicking Reset + // Then the table under the pinnedSections key follows, and nothing else is written + func test_menuBarApps_popupsAndResetWriteThePinnedTable() throws { + UserDefaults.standard.set(true, forKey: UserDefaults.Key.pinnedSectionsEnabled) + UserDefaults.standard.set(["com.test.a": MenuBarSection.hidden.rawValue, "com.test.b": MenuBarSection.visible.rawValue], + forKey: UserDefaultsPinnedSections.key) + var context = fullContext() + MenuBarAppsPane.makeViewController = { MenuBarAppsSettingsViewController(context: context) } + context.menuBarAppsAvailable = true + let controller = PreferencesWindowController(context: context) + windows.append(controller) + let views = Self.subviews(of: controller.pane(.menuBarApps).view) + + let popup = try XCTUnwrap(control(MenuBarAppsSettingsViewController.popupIdentifier(for: "com.test.a"), in: views) as? NSPopUpButton) + XCTAssertEqual(popup.selectedItem?.tag, MenuBarSection.hidden.rawValue) + popup.selectItem(withTag: MenuBarSection.alwaysHidden.rawValue) + popup.sendAction(popup.action, to: popup.target) + XCTAssertEqual(UserDefaults.standard.dictionary(forKey: UserDefaultsPinnedSections.key) as? [String: Int], + ["com.test.a": MenuBarSection.alwaysHidden.rawValue, "com.test.b": MenuBarSection.visible.rawValue]) + + let views2 = Self.subviews(of: controller.pane(.menuBarApps).view) + let reset = try XCTUnwrap(views2.compactMap { $0 as? NSButton }.first { $0.identifier?.rawValue == "pinnedSectionsReset" }) + reset.performClick(nil) + XCTAssertEqual(UserDefaults.standard.dictionary(forKey: UserDefaultsPinnedSections.key) as? [String: Int], + ["com.test.a": 0, "com.test.b": 0]) + } + + // Given the beta off + // When opening Menu Bar Apps + // Then it says so and lists no app + func test_menuBarApps_offShowsNoList() { + UserDefaults.standard.set(false, forKey: UserDefaults.Key.pinnedSectionsEnabled) + UserDefaults.standard.set(["com.test.a": MenuBarSection.hidden.rawValue], forKey: UserDefaultsPinnedSections.key) + var context = fullContext() + MenuBarAppsPane.makeViewController = { MenuBarAppsSettingsViewController(context: context) } + context.menuBarAppsAvailable = true + let controller = PreferencesWindowController(context: context) + windows.append(controller) + let views = Self.subviews(of: controller.pane(.menuBarApps).view) + XCTAssertNil(control(MenuBarAppsSettingsViewController.popupIdentifier(for: "com.test.a"), in: views)) + XCTAssertTrue(views.contains { ($0 as? NSTextField)?.stringValue == "Pinned sections is off".localized }) + } + // Given each tab // When selecting it // Then the tab control and the (hidden) window title follow, and General stays within 720 pt diff --git a/docs/MANUAL.md b/docs/MANUAL.md index f6d9b6da..9ae53b73 100644 --- a/docs/MANUAL.md +++ b/docs/MANUAL.md @@ -31,6 +31,15 @@ section is enabled. time, or stays visible if Hidden Bar has never seen it. The next collapse places it by where macOS put its icon, so a brand-new icon that macOS puts on the far left is hidden from then on; ⌘-drag it right of the arrow once. +- **Pinned sections (beta, on by default):** Hidden Bar keeps a section per app + and no longer reads it from where macOS put the icon after the app started. + An app seen for the first time starts visible. A ⌘-drag still moves an app + between sections, except in the moment right after it relaunched. + Settings › Menu Bar Apps lists every app with a Visible / Hidden / + Always hidden choice, which applies at once, and "Reset all to visible". An + app set to always hidden stays hidden when the bar expands; Option-click the + arrow to show it until the next collapse. Turn the beta off in Settings › Advanced to + get the position-based behavior above; it takes effect at the next collapse. - An icon whose app has no bundle identifier (a script run by an interpreter, some helpers) cannot be kept visible on macOS 27. Preferences offers to show all icons while one of them sits right of the arrow. @@ -64,14 +73,12 @@ A Menu Bar Apps tab joins the others on the macOS 27 direct build once the pinne Debug builds can draw every pane and status state, light and dark, to PNGs without showing a window: run the built binary with `-settingsSnapshotDir `; it quits when done and writes no preference. -> **Always-hidden section, current behavior:** items in the always-hidden zone -> are reliably pushed off-screen only when "hide separators" is also on -> (option-click the arrow). With the separators visible, always-hidden items can -> still appear after expanding. This coupling is a known limitation being -> reworked alongside the menu-bar redesign; for now, option-click to hide the -> separators if always-hidden items keep showing. Avoid placing critical icons in -> the always-hidden zone until the rework lands, since a stuck off-screen item has -> to be recovered by ⌘-dragging it back (macOS persists its position per app). +> **Always-hidden section:** every collapse hides the always-hidden section +> again, so it stays hidden when the bar expands. Option-click the arrow to show +> it (and ⌘-drag icons out of it) until the next collapse. To get lost icons +> back on macOS 26 and earlier, right-click the arrow and choose **Show +> Everything**. An icon macOS persisted off-screen still has to be ⌘-dragged +> back (macOS keeps its position per app). ## Behaviors you get for free diff --git a/docs/implementation-notes/pinned-sections-proof/04-first-read-collapsed.png b/docs/implementation-notes/pinned-sections-proof/04-first-read-collapsed.png new file mode 100644 index 00000000..5e5ceef1 Binary files /dev/null and b/docs/implementation-notes/pinned-sections-proof/04-first-read-collapsed.png differ diff --git a/docs/implementation-notes/pinned-sections-proof/07-list-sets-hidden-collapsed.png b/docs/implementation-notes/pinned-sections-proof/07-list-sets-hidden-collapsed.png new file mode 100644 index 00000000..6667905f Binary files /dev/null and b/docs/implementation-notes/pinned-sections-proof/07-list-sets-hidden-collapsed.png differ diff --git a/docs/implementation-notes/pinned-sections-proof/09-hidden-app-expanded.png b/docs/implementation-notes/pinned-sections-proof/09-hidden-app-expanded.png new file mode 100644 index 00000000..2e3c6a4f Binary files /dev/null and b/docs/implementation-notes/pinned-sections-proof/09-hidden-app-expanded.png differ diff --git a/docs/implementation-notes/pinned-sections-proof/10-hidden-after-relaunch-read-collapsed.png b/docs/implementation-notes/pinned-sections-proof/10-hidden-after-relaunch-read-collapsed.png new file mode 100644 index 00000000..287a867a Binary files /dev/null and b/docs/implementation-notes/pinned-sections-proof/10-hidden-after-relaunch-read-collapsed.png differ diff --git a/docs/implementation-notes/pinned-sections-proof/12-on-relaunch-placed-hidden-side-collapsed.png b/docs/implementation-notes/pinned-sections-proof/12-on-relaunch-placed-hidden-side-collapsed.png new file mode 100644 index 00000000..645296e7 Binary files /dev/null and b/docs/implementation-notes/pinned-sections-proof/12-on-relaunch-placed-hidden-side-collapsed.png differ diff --git a/docs/implementation-notes/pinned-sections-proof/14-off-relaunch-placed-hidden-side-collapsed.png b/docs/implementation-notes/pinned-sections-proof/14-off-relaunch-placed-hidden-side-collapsed.png new file mode 100644 index 00000000..e10d489e Binary files /dev/null and b/docs/implementation-notes/pinned-sections-proof/14-off-relaunch-placed-hidden-side-collapsed.png differ diff --git a/docs/implementation-notes/pinned-sections.md b/docs/implementation-notes/pinned-sections.md new file mode 100644 index 00000000..dbe69ae2 --- /dev/null +++ b/docs/implementation-notes/pinned-sections.md @@ -0,0 +1,102 @@ +# Pinned sections (#366): delta from the decision brief + +Spec: `docs/briefs/DECISION-BRIEF-366-overflow-bar.md` (PR #472), sections 3B, 3C, 5. Han's answers: Q1 yes (macOS 27 direct is the main product), Q2 never-seen apps default to visible, a ⌘-drag keeps editing the table unless the app just relaunched, the Preferences list edits it too, Q3 yes (deeper MenuBarClientCore bet, no Screen Recording). Base `develop` at `af0f151`. + +Only what differs from the brief, or what the brief left open, is recorded here. + +This file is force-added: `.gitignore` keeps `docs/implementation-notes/` in the local tooling layer, which is how SPEC-003 was lost (brief, top). + +## Phase 1: section table + +- **A drag is a change between two reads, not a difference from the table.** The brief says "section differs from table: user dragged". That would undo every Preferences edit and every "new apps" default on the next collapse: a never-seen app's icon lands far left, so the next read finds it on the hidden side, which differs from its default `visible`. The resolver compares each app's read section with the section it was read in last time (the existing `nativeVisibilityLastSections` memory, now the "observed" baseline). It updates the table only when that changed and the app did not launch since the last read. The baseline is updated on every read, relaunched apps included, so the position macOS gave a relaunched icon becomes the new reference. +- **An app missing from the table that did not just launch takes its read position** (and is added to the table). Only an app that launched since the last read gets the visible default. Reason: users upgrading from 1.11.0/1.11.1 on 27 have an arrangement but no memory to seed from; taking positions for apps that were already running keeps their arrangement on the first collapse (exactly what v1.11.2 does). +- **No "Show new menu bar apps" preference.** Q2 settled the default (visible); it is a constant (`PinnedSectionResolver.newAppSection`). A toggle is one checkbox later if anyone asks. +- **Seeding is lazy.** `UserDefaultsPinnedSections` returns the v1.11.2 memory until its own key (`pinnedSections`) is first written, which happens at the first read with the beta on. A user who leaves the beta off never gets a table; turning it on later seeds from the memory as it is then. +- **The beta checkbox takes effect at the next collapse**, not at once: a collapsed bar keeps its current restriction until then. +- **"Reset all to visible"** is a Preferences button next to the beta checkbox (the list arrives in phase 2) and the debug hook `reset-pinned`. It resets apps that are not running too. +- **Debug hooks added** (Debug builds only): `pinned-sections on|off`, `pin =visible|hidden|alwaysHidden` (what a list row runs), `reset-pinned`. `dump-state` gains `pinsSections`, `pinnedSections`, `observedSections`, `launchedSinceRead`. + +| Proof | Result | +|---|---| +| `bash scripts/test.sh` | Direct 220, App Store 176, 0 failed (baseline 209 / 165); +11 `PinnedSectionsTests` | +| Negative controls (local mutation script, one mutant at a time) | relaunch counts as a drag: 2 fail; drag = differs from the table (the brief's literal rule): 4; new app takes its position: 2; beta ignored (= v1.11.2): 5; Preferences edits not applied: 2; launched app uses the read memory: 1 | +| Beta off = v1.11.2 | every pre-existing engine test runs with the beta off (the default in the engine init) and passes unchanged; `testWithTheBetaOffARelaunchedAppGoesWhereMacOSPutsIt` pins the old drift and that the table is untouched | +| Release warnings | Release-Direct (signed) and App Store Release: identical set to `af0f151` | + +## Phase 2: Preferences list and always-hidden + +- **Always-hidden on 27 with the beta on.** The always-hidden section is held hidden while expanded when the table has an always-hidden app, even with the always-hidden separator disabled (an app can be set always-hidden from the Preferences list alone). The "hide separators" state is set again at every collapse, so Option-click becomes "show everything until the next collapse" instead of a persisted mode. That is what makes #224 hold without the user ever Option-clicking, and the collapse after an Option-click is a read from an unrestricted bar, so ⌘-drags made while everything showed are recorded. Same rule as the legacy decouple (phase 3), one mental model on both engines. +- **"Hide separators" is re-set by the controller, through the engine.** `MenuBarEngine.separatorsHiddenForCollapse(current:)` says what state a collapse should leave; the controller runs its own `hideSeparators()` when that differs, so the stored preference, the Option-click toggle and the engine agree. Native engine: `true` with the beta on, unchanged with it off. Cost: the first collapse after an Option-click reads the bar twice (the re-hide on the expanded bar, then the collapse); the first read is superseded by generation, so only one AX snapshot is used. +- **The list** sits under the beta checkbox in Preferences (macOS 27 direct only): a 150 pt scroll view, one row per table app (NSWorkspace icon and name, a Visible / Hidden / Always hidden popup), then "Reset all to visible". Apps that are not installed any more show their bundle id; Control Center's extras show as "macOS extras". It reloads on open and after every edit; a collapse while it is open does not refresh it (it reloads next time it opens). Row order and naming are `PinnedSectionsList.entries`, unit-tested; the view code is not (Preferences is not in a test target). +- **Finding: NSWorkspace does not post launches of agent apps.** `didLaunchApplicationNotification` skips LSUIElement / background apps, and most menu-bar apps are agents. On screen, the helper (an LSUIElement app) never reached `launchedSinceRead` on the 1.11.2 code path, so it never got the new-app default and took its far-left position (`hidden`); an agent the user keeps visible would likewise read as dragged when macOS re-places it after a relaunch. Fix: `AgentLaunchNotifications` watches `NSWorkspace.runningApplications` (KVO) and posts agent starts and quits on its own center, which the engine observes next to NSWorkspace's; apps with a Dock icon stay with NSWorkspace, so none is reported twice. **This is also why the shipped 1.11.2 launch handling (#446, `a017d6a`) does not help most menu-bar apps.** Decided: it runs with the beta off too (own commit, `AgentLaunchNotifications.isActive(pinnedSectionsEnabled:)`; `testWithPinnedSectionsOffAgentStartsAreStillReported` fails when it returns the beta state, the earlier behavior). So beta off is v1.11.2 plus agent-launch detection. + +| Proof | Result | +|---|---| +| `bash scripts/test.sh` | Direct 227, App Store 183, 0 failed | +| Negative controls | pinned always-hidden ignored: 2 fail; no re-hide at collapse: 1; edits skip the expanded bar: 1; list unsorted: 1; agent center not observed: 1; Dock apps reported twice: 1 | +| Release warnings | clean Release-Direct (signed) and App Store Release: identical set to `af0f151` (one new Sendable warning was found and fixed) | +| On screen (this Mini, 27.2.1, two displays) | helper `foundation.dwarves.pinprobe` launched while collapsed: `launchedSinceRead` has it, section visible at once; first read finds its icon at x=686, left of the arrow (x=724-756): observed `hidden`, pinned `visible`; same on a second read; quit and relaunch while collapsed: still `visible`; `pin =hidden` (the list row's action): `hidden`, survives the next read; `boundary 656` (drag stand-in): `visible`; `pin =alwaysHidden` on the expanded bar and `reset-pinned`: table follows, reset leaves 34 apps all `visible`; beta off: the same relaunch reads `hidden` (v1.11.2 drift). Prefs exported before and identical after, no new SU* keys, installed app relaunched. No pointer or key input. | +| Restriction swap on screen | first runs were blocked by a microphone in use; proven after #475, see "On screen from /Applications" below | + +## Phase 3: legacy patches (option C) + +- **Decouple = re-hide at every collapse.** The legacy engine can only hide the always-hidden section by inflating its separator, so "always hidden" and "hide separators" are the same mechanism; what users hit (#224) is that the stored Option-click state decided it, and enabling the section stores "shown". Now every collapse hides the section again (the same `separatorsHiddenForCollapse` hook as the native beta), so an expand keeps it hidden and Option-click is a reveal until the next collapse. The misplaced-separator guard (`isBtnAlwaysHiddenValidPosition`) still applies: a separator on the wrong side is never inflated. +- **"Show Everything"** is a right-click menu item on the arrow (and the separator), legacy engine only: expands the bar and shows the always-hidden section, until the next collapse. It does not move icons macOS persisted off-screen (#242's permanent case); MANUAL says so. +- **Gated to macOS 26 and earlier** (`osMajorVersion < 27`, injected for tests). The App Store build also runs this engine on 27, where inflating is ejected; nothing changes there, per "no behavior change on 27". +- The controller wiring (when to call `hideSeparators()`, the menu item) is not unit-tested: StatusBarController owns real status items. Engine flags are tested and mutation-checked. +- **No macOS 26 run.** This Mini is on 27.2.1. A run on a 26 Mac is needed before release: enable the always-hidden section, collapse, expand (section stays hidden), Option-click (shows), collapse, expand (hidden again), right-click › Show Everything. + +| Proof | Result | +|---|---| +| `bash scripts/test.sh` | Direct 232, App Store 188, 0 failed (baseline 209 / 165) | +| Negative controls | no decouple (= af0f151): 2 fail; no Show Everything (= af0f151): 1; patches on 27: 1 | +| Legacy and App Store = af0f151 apart from C | every pre-existing `LegacyLengthEngineTests` / `MenuBarOrderTests` case is unchanged and passes in both schemes; on 27 the legacy engine reports no patch (`testNothingChangesOnMacOS27`) | +| Release warnings | clean builds, identical set to `af0f151` | + +## Phase 4: hidden-items menu (thin A), not built + +Follow-up, as the brief's phase 3: generalise `NotchOverflowController` into a menu off the arrow on 27 (direct): one row per app the table has in `hidden` / `alwaysHidden`, app icon from NSWorkspace (no Screen Recording, Q3). A click allows that bundle (swap the restriction, as `allowLaunchedAppsIfIdle` does), AXPresses its item, and re-hides when its menu closes, reusing the `NotificationCenterSession` pattern. The table from this PR gives the menu its rows for free. Test without input: a Debug hook that opens the menu, a helper that writes a marker file when its menu opens, AXPress through the proxy, and `dump-state` showing the restriction back within one check. + +## Settings window (after #481) + +The redesigned Settings window (#481) replaced the storyboard Preferences, so the phase 1 and 2 UI notes above (checkbox, 150 pt list) are superseded: + +- **Menu Bar Apps tab** (`MenuBarAppsSettingsViewController`): registered in `MenuBarAppsPane.makeViewController` at launch when the native engine runs (direct build, macOS 27), after `-settingsSnapshotDir` is checked, so the generic snapshot loop never draws this Mac's apps. Grouped rows: app icon (NSWorkspace, no capture), name without ".app", a Visible / Hidden / Always hidden popup; a second group "Reset all to visible". Beta off: one row "Pinned sections is off" with a Turn On button (the tab stays, so the switch is findable). No apps yet: one row saying apps appear after a collapse. The list scrolls past 360 pt. It rebuilds on open, on every pref change and on `.pinnedSectionsChanged`. +- **Store seam**: the pane reads and writes through `MenuBarAppsStore`; `LiveMenuBarAppsStore` is the app's prefs, `SnapshotMenuBarAppsStore` (Debug) gives the on / off / empty fixtures for `-settingsSnapshotDir` (`direct-menubarapps--.png`). +- **"Pinned sections (beta)" switch** is in Advanced, native engine only, bound to `pinnedSectionsEnabled`, now also a registered default (`true`) in `AppDelegate.defaultPreferenceValues`. +- **Keys in the tests and the import whitelist**: `pinnedSectionsEnabled` joins `SettingsWindowTests.legacyBoolKeys` (and the App Store build's no-direct-rows list); `pinnedSections` joins `legacyOtherKeys`. Both join `AppStoreSettingsImport.importableKeys` (#474); the table is a dictionary, so the importer gains a `.dictionary` kind. +- New strings carry English text in every locale, like #481's. + +| Proof | Result | +|---|---| +| `bash scripts/test.sh` | Direct 285, App Store 210, 0 failed | +| Negative controls | Advanced switch unbound: `test_everyOldSwitch_stillWritesItsKey` fails; popup writes nothing: `test_menuBarApps_popupsAndResetWriteThePinnedTable` fails; beta keys out of the whitelist: `testWhitelistCoversEveryPreferenceKeyTheAppDefines` fails | +| Snapshots | Menu Bar Apps on, off, empty, light and dark, plus Advanced, drawn offscreen with `-settingsSnapshotDir` | + +## On screen from /Applications (after #475) + +macOS 27 applies the allow-list only to apps it keys by bundle id, which in practice means apps in /Applications; a copy run elsewhere hides even its own arrow. So the #473 Debug-Direct build (head `b0a283d`, Developer ID signed) and a helper status-item app with a magenta 16 pt icon (`foundation.dwarves.pinprobeb`) ran from /Applications. The installed app was renamed aside and renamed back; its CDHash was identical after, login items unchanged, prefs identical (extra test keys removed before the re-import). Truth is pixels: magenta pixels in a screenshot of the menu bar (1024 = the whole icon at 2x), plus AX x of the probe and the arrow. No pointer or key input. + +| Step | Beta | Magenta px | Result | +|---|---|---|---| +| New app launched while collapsed | on | 1024 | shown at once (new-app default) | +| Pinned visible, quit and relaunched while collapsed, then a read | on | 1024 | stays shown | +| List sets it hidden (collapsed) | on | 0 | hidden at once | +| Pinned hidden, relaunched while collapsed; expanded; collapsed again | on | 0 / 1024 / 0 | hidden, shown with the bar, hidden again | +| Relaunched, its icon then read on the hidden side (boundary hook) | on | 1024 | stays shown: pinned `visible`, observed `hidden` | +| Same relaunch and read | off | 0 | drifts to hidden (v1.11.2) | + +macOS kept this probe's slot right of the arrow across relaunches, so "macOS re-placed the icon on the hidden side" was stood in for with the debug boundary moved just right of the probe after the relaunch, for both runs. Crops: `docs/implementation-notes/pinned-sections-proof/`. + +## Decided (Han, 2026-11-15) + +1. Agent-launch source for beta-off users too: yes, shipped as its own commit (see the phase 2 finding). Test counts after it: Direct 233, App Store 189. +2. Option-click shows the always-hidden section until the next collapse, on both engines: accepted. +3. For the beta, the Preferences list is the path for always-hidden apps (their icons are hidden while expanded, so a ⌘-drag needs Option-click first): accepted. +4. Apps that recreate their icon without relaunching (SwiftBar refresh) can still look like a drag: later. + +## Follow-ups + +- Per-app ignore-drags lock, for apps whose icon is recreated without a relaunch (decision 4). +- Hidden-items menu (thin A), phase 4 above. +- macOS 26 run of the legacy patches before release (phase 3). diff --git a/hidden/AppDelegate.swift b/hidden/AppDelegate.swift index 2723f103..c2a9d19a 100644 --- a/hidden/AppDelegate.swift +++ b/hidden/AppDelegate.swift @@ -31,6 +31,12 @@ class AppDelegate: NSObject, NSApplicationDelegate{ if SettingsSnapshot.runIfRequested() { return } #endif guard ensureSingleInstance() else { return } + #if HIDDENBAR_NATIVE_VISIBILITY + // Pinned sections (beta) fill the Settings tab the native engine has. + if MenuBarEngineFactory.usesNativeEngine() { + MenuBarAppsPane.makeViewController = { MenuBarAppsSettingsViewController(context: .live) } + } + #endif setupAutoStartApp() registerDefaultValues() setupHotKey() @@ -113,7 +119,8 @@ class AppDelegate: NSObject, NSApplicationDelegate{ UserDefaults.Key.notchOverflowEnabled: true, UserDefaults.Key.stealthExpandIconEnabled: false, UserDefaults.Key.arrowStyle: ArrowStyle.default.rawValue, - UserDefaults.Key.showWholeBarWhenCaptureStarts: true + UserDefaults.Key.showWholeBarWhenCaptureStarts: true, + UserDefaults.Key.pinnedSectionsEnabled: true ] func registerDefaultValues() { diff --git a/hidden/Common/Preferences.swift b/hidden/Common/Preferences.swift index 44885863..aaaa3a2c 100644 --- a/hidden/Common/Preferences.swift +++ b/hidden/Common/Preferences.swift @@ -180,4 +180,17 @@ enum Preferences { NotificationCenter.default.post(Notification(name: .prefsChanged)) } } + + // macOS 27, direct build: the section table decides where each app goes + // (beta). On by default; off is v1.11.2's position-based sections. + static var pinnedSectionsEnabled: Bool { + get { + UserDefaults.standard.object(forKey: UserDefaults.Key.pinnedSectionsEnabled) as? Bool ?? true + } + + set { + UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.pinnedSectionsEnabled) + NotificationCenter.default.post(Notification(name: .prefsChanged)) + } + } } diff --git a/hidden/Extensions/UserDefault+Extension.swift b/hidden/Extensions/UserDefault+Extension.swift index fcd340be..02fdcd84 100644 --- a/hidden/Extensions/UserDefault+Extension.swift +++ b/hidden/Extensions/UserDefault+Extension.swift @@ -24,5 +24,6 @@ extension UserDefaults { static let notchOverflowEnabled = "notchOverflowEnabled" static let pauseHidingForUnkeepableItems = "pauseHidingForUnkeepableItems" static let showWholeBarWhenCaptureStarts = "showWholeBarWhenCaptureStarts" + static let pinnedSectionsEnabled = "pinnedSectionsEnabled" } } diff --git a/hidden/Features/AppStoreMigration/AppStoreMigration.swift b/hidden/Features/AppStoreMigration/AppStoreMigration.swift index 4cb1c863..e0d7c11d 100644 --- a/hidden/Features/AppStoreMigration/AppStoreMigration.swift +++ b/hidden/Features/AppStoreMigration/AppStoreMigration.swift @@ -34,7 +34,7 @@ struct MigrationOfferLedger { /// The settings import, free of AppKit so it is testable with plain dictionaries. enum AppStoreSettingsImport { - enum Kind { case number, string, data } + enum Kind { case number, string, data, dictionary } /// Every preference the app defines, with the plist type it is stored as. /// Anything else in the container (Sparkle SU* keys, window frames, status @@ -53,6 +53,8 @@ enum AppStoreSettingsImport { UserDefaults.Key.hoverToExpand: .number, UserDefaults.Key.notchOverflowEnabled: .number, UserDefaults.Key.pauseHidingForUnkeepableItems: .number, + UserDefaults.Key.pinnedSectionsEnabled: .number, + UserDefaultsPinnedSections.key: .dictionary, ] static func containerPreferencesURL(home: URL, bundleIdentifier: String) -> URL { @@ -71,6 +73,7 @@ enum AppStoreSettingsImport { case .number?: return value is NSNumber case .string?: return value is String case .data?: return value is Data + case .dictionary?: return value is [String: Any] case nil: return false } } diff --git a/hidden/Features/Settings/AdvancedSettingsViewController.swift b/hidden/Features/Settings/AdvancedSettingsViewController.swift index a70e55ed..4fece1c5 100644 --- a/hidden/Features/Settings/AdvancedSettingsViewController.swift +++ b/hidden/Features/Settings/AdvancedSettingsViewController.swift @@ -40,6 +40,13 @@ final class AdvancedSettingsViewController: SettingsPaneController { macOSAlsoHidesCaption = Self.captionLabel(in: row) rows.append(row) onRefresh { [weak self] in self?.refreshMacOSAlsoHides() } + + let pinned = boundSwitch(UserDefaults.Key.pinnedSectionsEnabled, + read: { Preferences.pinnedSectionsEnabled }, + write: { Preferences.pinnedSectionsEnabled = $0 }) + rows.append(SettingsForm.row("Pinned sections (beta)".localized, + caption: "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse.".localized, + control: pinned)) } let method = NSTextField(labelWithString: (context.usesNativeEngine ? "macOS 27 visibility" : "Separator").localized) diff --git a/hidden/Features/Settings/MenuBarAppsSettingsViewController.swift b/hidden/Features/Settings/MenuBarAppsSettingsViewController.swift new file mode 100644 index 00000000..0aac1bc9 --- /dev/null +++ b/hidden/Features/Settings/MenuBarAppsSettingsViewController.swift @@ -0,0 +1,226 @@ +// +// MenuBarAppsSettingsViewController.swift +// Hidden Bar +// +// Copyright © 2026 Dwarves Foundation. All rights reserved. +// + +import AppKit +import UniformTypeIdentifiers + +/// Where the Menu Bar Apps pane reads and writes the pinned sections (beta). +/// The live store is the app's preferences; snapshots pass fixed data. +protocol MenuBarAppsStore { + var isEnabled: Bool { get } + func entries() -> [PinnedSectionsList.Entry] + func icon(for bundle: String) -> NSImage? + func set(_ section: MenuBarSection, for bundle: String) + func resetAllToVisible() + func enable() +} + +struct LiveMenuBarAppsStore: MenuBarAppsStore { + var isEnabled: Bool { Preferences.pinnedSectionsEnabled } + + func entries() -> [PinnedSectionsList.Entry] { + PinnedSectionsList.entries(table: UserDefaultsPinnedSections().sections, name: Self.appName) + } + + // "Safari", without ".app" even when Finder shows extensions. + static func appName(_ bundle: String) -> String? { + NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundle)?.deletingPathExtension().lastPathComponent + } + + // The app's own icon, from its bundle: no screen capture. + func icon(for bundle: String) -> NSImage? { + NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundle).map { NSWorkspace.shared.icon(forFile: $0.path) } + } + + func set(_ section: MenuBarSection, for bundle: String) { + PinnedSectionEdits.set(section, for: bundle, in: UserDefaultsPinnedSections()) + } + + func resetAllToVisible() { + PinnedSectionEdits.resetAllToVisible(in: UserDefaultsPinnedSections()) + } + + func enable() { + Preferences.pinnedSectionsEnabled = true + } +} + +/// Menu Bar Apps: one row per app the pinned sections know, with its icon, its +/// name and a section popup that applies at once, then "Reset all to visible". +final class MenuBarAppsSettingsViewController: SettingsPaneController { + static let sectionTitles: [(MenuBarSection, String)] = [ + (.visible, "Visible"), (.hidden, "Hidden"), (.alwaysHidden, "Always hidden"), + ] + /// Identifier of each row's popup: the defaults key, then the bundle id. + static func popupIdentifier(for bundle: String) -> String { + "\(UserDefaultsPinnedSections.key).\(bundle)" + } + static let maxListHeight: CGFloat = 360 + + private let store: MenuBarAppsStore + private let content = NSStackView() + + init(context: SettingsContext, store: MenuBarAppsStore = LiveMenuBarAppsStore()) { + self.store = store + super.init(context: context) + } + + required init?(coder: NSCoder) { fatalError("init(coder:) is not used") } + + override func buildForm() { + content.orientation = .vertical + content.alignment = .leading + content.spacing = 6 + addFullWidth(content) + onRefresh { [weak self] in self?.rebuild() } + NotificationCenter.default.addObserver(self, selector: #selector(refreshAll), name: .pinnedSectionsChanged, object: nil) + rebuild() + } + + override func viewWillAppear() { + super.viewWillAppear() + // A collapse adds apps to the table while the window is closed. + rebuild() + } + + private func rebuild() { + content.arrangedSubviews.forEach { $0.removeFromSuperview() } + guard store.isEnabled else { + let turnOn = NSButton(title: "Turn On".localized, target: self, action: #selector(turnOn)) + turnOn.controlSize = .small + add(SettingsGroupView(rows: [SettingsForm.row( + "Pinned sections is off".localized, + caption: "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app.".localized, + control: turnOn)])) + return + } + let entries = store.entries() + add(SettingsForm.caption("Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too.".localized)) + if entries.isEmpty { + add(SettingsGroupView(rows: [SettingsForm.row( + "No apps yet".localized, + caption: "Apps with a menu bar icon appear here after the bar collapses once.".localized, + control: nil)])) + } else { + add(list(entries)) + } + let reset = NSButton(title: "Reset".localized, target: self, action: #selector(resetAll)) + reset.controlSize = .small + reset.identifier = NSUserInterfaceItemIdentifier("pinnedSectionsReset") + add(SettingsGroupView(rows: [SettingsForm.row( + "Reset all to visible".localized, + caption: "Shows every app, including ones that are not running now.".localized, + control: reset)])) + } + + private func add(_ view: NSView) { + content.addArrangedSubview(view) + view.widthAnchor.constraint(equalTo: content.widthAnchor).isActive = true + } + + // The group scrolls once it is taller than the window should grow. + private func list(_ entries: [PinnedSectionsList.Entry]) -> NSView { + let group = SettingsGroupView(rows: entries.map(row)) + let height = min(group.fittingSize.height, Self.maxListHeight) + guard group.fittingSize.height > Self.maxListHeight else { return group } + let document = FlippedView() + document.translatesAutoresizingMaskIntoConstraints = false + document.addSubview(group) + let scroll = NSScrollView() + scroll.translatesAutoresizingMaskIntoConstraints = false + scroll.hasVerticalScroller = true + scroll.drawsBackground = false + scroll.borderType = .noBorder + scroll.documentView = document + NSLayoutConstraint.activate([ + group.topAnchor.constraint(equalTo: document.topAnchor), + group.leadingAnchor.constraint(equalTo: document.leadingAnchor), + group.trailingAnchor.constraint(equalTo: document.trailingAnchor), + group.bottomAnchor.constraint(equalTo: document.bottomAnchor), + document.widthAnchor.constraint(equalTo: scroll.contentView.widthAnchor), + scroll.heightAnchor.constraint(equalToConstant: height), + ]) + return scroll + } + + private func row(_ entry: PinnedSectionsList.Entry) -> NSView { + let popup = NSPopUpButton(frame: .zero, pullsDown: false) + popup.controlSize = .small + for (section, title) in Self.sectionTitles { + popup.addItem(withTitle: title.localized) + popup.lastItem?.tag = section.rawValue + } + popup.selectItem(withTag: entry.section.rawValue) + popup.identifier = NSUserInterfaceItemIdentifier(Self.popupIdentifier(for: entry.bundle)) + popup.target = self + popup.action = #selector(sectionPicked(_:)) + + let row = SettingsForm.row(entry.name, control: popup) + row.toolTip = entry.bundle + let icon = NSImageView(image: store.icon(for: entry.bundle) ?? NSWorkspace.shared.icon(for: .applicationBundle)) + icon.translatesAutoresizingMaskIntoConstraints = false + icon.imageScaling = .scaleProportionallyUpOrDown + row.addSubview(icon) + // Make room for the icon: move the title's leading edge right of it. + if let texts = row.subviews.first(where: { $0 is NSStackView }) { + row.constraints.first { $0.firstItem === texts && $0.firstAttribute == .leading }?.constant = SettingsMetrics.rowInset + 26 + } + NSLayoutConstraint.activate([ + icon.leadingAnchor.constraint(equalTo: row.leadingAnchor, constant: SettingsMetrics.rowInset), + icon.centerYAnchor.constraint(equalTo: row.centerYAnchor), + icon.widthAnchor.constraint(equalToConstant: 18), + icon.heightAnchor.constraint(equalToConstant: 18), + ]) + return row + } + + @objc private func sectionPicked(_ sender: NSPopUpButton) { + guard let raw = sender.identifier?.rawValue, + let section = sender.selectedItem.flatMap({ MenuBarSection(rawValue: $0.tag) }) else { return } + store.set(section, for: String(raw.dropFirst(UserDefaultsPinnedSections.key.count + 1))) + } + + @objc private func resetAll() { + store.resetAllToVisible() + } + + @objc private func turnOn() { + store.enable() + } +} + +/// A scroll view's document grows downward only when flipped. +private final class FlippedView: NSView { + override var isFlipped: Bool { true } +} + +#if DEBUG +/// Fixed content for `-settingsSnapshotDir`: the pane on, off and empty. +struct SnapshotMenuBarAppsStore: MenuBarAppsStore { + var isEnabled: Bool + var table: [String: MenuBarSection] + + static let states: [(String, SnapshotMenuBarAppsStore)] = [ + ("on", SnapshotMenuBarAppsStore(isEnabled: true, table: [ + "com.apple.Safari": .visible, "com.apple.Notes": .hidden, "com.apple.Music": .alwaysHidden, + "com.apple.controlcenter": .visible, "com.apple.ActivityMonitor": .hidden, + "com.example.uninstalled": .hidden, + ])), + ("off", SnapshotMenuBarAppsStore(isEnabled: false, table: [:])), + ("empty", SnapshotMenuBarAppsStore(isEnabled: true, table: [:])), + ] + + func entries() -> [PinnedSectionsList.Entry] { + PinnedSectionsList.entries(table: table, name: LiveMenuBarAppsStore.appName) + } + + func icon(for bundle: String) -> NSImage? { LiveMenuBarAppsStore().icon(for: bundle) } + func set(_ section: MenuBarSection, for bundle: String) {} + func resetAllToVisible() {} + func enable() {} +} +#endif diff --git a/hidden/Features/Settings/SettingsSnapshot.swift b/hidden/Features/Settings/SettingsSnapshot.swift index 6669458b..fab2a7a9 100644 --- a/hidden/Features/Settings/SettingsSnapshot.swift +++ b/hidden/Features/Settings/SettingsSnapshot.swift @@ -41,6 +41,19 @@ enum SettingsSnapshot { shoot(PreferencesWindowController(context: context), tab: .general, appearance: appearance, to: dir.appendingPathComponent("\(build)-status-\(status)-\(mode).png")) } + // Menu Bar Apps with the pinned sections on, off and empty, from + // fixed data: the live table would put this Mac's apps in the shots. + let registered = MenuBarAppsPane.makeViewController + for (state, store) in SnapshotMenuBarAppsStore.states { + var context = live + context.build = .direct + context.osMajorVersion = 27 + context.menuBarAppsAvailable = true + MenuBarAppsPane.makeViewController = { MenuBarAppsSettingsViewController(context: context, store: store) } + shoot(PreferencesWindowController(context: context), tab: .menuBarApps, appearance: appearance, + to: dir.appendingPathComponent("\(build)-menubarapps-\(state)-\(mode).png")) + } + MenuBarAppsPane.makeViewController = registered // The preview strip per engine, with the always-hidden section on. for (os, engine) in [(27, "macos27"), (26, "macos26")] { var context = live diff --git a/hidden/Features/StatusBar/Engine/LegacyLengthEngine.swift b/hidden/Features/StatusBar/Engine/LegacyLengthEngine.swift index e2fe9d3d..b6c4cd65 100644 --- a/hidden/Features/StatusBar/Engine/LegacyLengthEngine.swift +++ b/hidden/Features/StatusBar/Engine/LegacyLengthEngine.swift @@ -26,10 +26,35 @@ final class LegacyLengthEngine: MenuBarEngine { // for a working user. The action lands once this log calibrates the signal. private var hideMechanismChecked = false + // The recovery patches (#224, #242) apply up to macOS 26, where this engine + // hides. On 27 (the App Store build) inflating is ejected anyway, and + // nothing changes there. + private let osMajorVersion: Int + init(items: MenuBarItemProvider, - screenWidths: @escaping () -> [CGFloat] = { NSScreen.screens.map { $0.frame.width } }) { + screenWidths: @escaping () -> [CGFloat] = { NSScreen.screens.map { $0.frame.width } }, + osMajorVersion: Int = ProcessInfo.processInfo.operatingSystemVersion.majorVersion) { self.items = items self.screenWidths = screenWidths + self.osMajorVersion = osMajorVersion + } + + private var appliesRecoveryPatches: Bool { + return osMajorVersion < 27 + } + + // The always-hidden section used to stay hidden only while "hide + // separators" was on (Option-click), so with the default it showed on every + // expand (#224). Every collapse now hides it again; Option-click shows it + // until the next collapse. + func separatorsHiddenForCollapse(current: Bool) -> Bool { + return appliesRecoveryPatches ? true : current + } + + // "Show everything" in the arrow's menu: expand and show the always-hidden + // section too, for icons the user lost there (#242). + var offersShowEverything: Bool { + return appliesRecoveryPatches } // Derived from the live length rather than stored, and compared with > rather diff --git a/hidden/Features/StatusBar/Engine/MenuBarEngine.swift b/hidden/Features/StatusBar/Engine/MenuBarEngine.swift index 06aeaa67..bd29c277 100644 --- a/hidden/Features/StatusBar/Engine/MenuBarEngine.swift +++ b/hidden/Features/StatusBar/Engine/MenuBarEngine.swift @@ -46,6 +46,15 @@ protocol MenuBarEngine: AnyObject { // The user expanded or collapsed the bar, so a clock click no longer // collapses it when Notification Center closes. func userChangedBar() + + // The "hide separators" state a collapse should leave behind. True when the + // engine keeps the always-hidden section hidden on every expand, so + // Option-click shows it only until the next collapse. + func separatorsHiddenForCollapse(current: Bool) -> Bool + + // Whether the arrow's menu offers "Show everything" (expand and show the + // always-hidden section), the recovery for icons lost there. + var offersShowEverything: Bool { get } } extension MenuBarEngine { @@ -53,6 +62,8 @@ extension MenuBarEngine { var defersAutoCollapse: Bool { return false } var menuBarItemOwners: Set { return [] } func userChangedBar() {} + func separatorsHiddenForCollapse(current: Bool) -> Bool { return current } + var offersShowEverything: Bool { return false } } enum MenuBarEngineState { diff --git a/hidden/Features/StatusBar/Engine/MenuBarEngineFactory.swift b/hidden/Features/StatusBar/Engine/MenuBarEngineFactory.swift index 92eb74e3..424962f6 100644 --- a/hidden/Features/StatusBar/Engine/MenuBarEngineFactory.swift +++ b/hidden/Features/StatusBar/Engine/MenuBarEngineFactory.swift @@ -31,7 +31,12 @@ enum MenuBarEngineFactory { pausesHidingForUnkeepableItems: { Preferences.pauseHidingForUnkeepableItems }, expandsWhenCaptureStarts: { Preferences.showWholeBarWhenCaptureStarts }, sectionMemory: UserDefaultsSectionMemory(), - workspaceNotifications: NSWorkspace.shared.notificationCenter) + workspaceNotifications: NSWorkspace.shared.notificationCenter, + pinnedSections: UserDefaultsPinnedSections(), + pinsSections: { Preferences.pinnedSectionsEnabled }, + agentLaunches: AgentLaunchNotifications(isActive: { + AgentLaunchNotifications.isActive(pinnedSectionsEnabled: Preferences.pinnedSectionsEnabled) + })) } #endif return LegacyLengthEngine(items: items) diff --git a/hidden/Features/StatusBar/Engine/NativeVisibilityEngine.swift b/hidden/Features/StatusBar/Engine/NativeVisibilityEngine.swift index 92368d33..73a669ee 100644 --- a/hidden/Features/StatusBar/Engine/NativeVisibilityEngine.swift +++ b/hidden/Features/StatusBar/Engine/NativeVisibilityEngine.swift @@ -100,7 +100,16 @@ final class NativeVisibilityEngine: MenuBarEngine { // Apps that started since a read last listed them. private var launchedSinceRead: Set = [] private let workspaceNotifications: NotificationCenter? - private var workspaceObservers: [NSObjectProtocol] = [] + // Starts and quits of agent apps (no Dock icon), which NSWorkspace does + // not post; most menu-bar apps are agents. Fed only with pinned sections on. + private let agentLaunches: NotificationCenter? + private var workspaceObservers: [(NotificationCenter, NSObjectProtocol)] = [] + + // Pinned sections (beta): with it on, the table decides each app's section + // and a read only edits it (PinnedSectionResolver). Off, sections come from + // positions as in v1.11.2. + private let pinnedSections: MenuBarSectionMemory + private let pinsSections: () -> Bool // Items right of the arrow that the allow-list cannot keep visible: an item // whose owner has no bundle id, or a system extra no system item id covers @@ -128,8 +137,14 @@ final class NativeVisibilityEngine: MenuBarEngine { pausesHidingForUnkeepableItems: @escaping () -> Bool = { false }, expandsWhenCaptureStarts: @escaping () -> Bool = { true }, sectionMemory: MenuBarSectionMemory = InMemorySectionMemory(), - workspaceNotifications: NotificationCenter? = nil) { + workspaceNotifications: NotificationCenter? = nil, + pinnedSections: MenuBarSectionMemory = InMemorySectionMemory(), + pinsSections: @escaping () -> Bool = { false }, + agentLaunches: NotificationCenter? = nil) { self.items = items + self.agentLaunches = agentLaunches + self.pinnedSections = pinnedSections + self.pinsSections = pinsSections self.pausesHidingForUnkeepableItems = pausesHidingForUnkeepableItems self.inventory = inventory self.visibility = visibility @@ -152,7 +167,7 @@ final class NativeVisibilityEngine: MenuBarEngine { } deinit { - workspaceObservers.forEach { workspaceNotifications?.removeObserver($0) } + workspaceObservers.forEach { center, observer in center.removeObserver(observer) } } func collapse(completion: @escaping (CollapseResult) -> Void) { @@ -241,8 +256,18 @@ final class NativeVisibilityEngine: MenuBarEngine { } } + // With pinned sections an app can be always hidden without the separator + // (Preferences sets it), so a pinned always-hidden app counts too. private var hidesAlwaysHiddenSection: Bool { - return alwaysHiddenEnabled && alwaysHiddenSeparatorHidden + let hasSection = alwaysHiddenEnabled + || (pinsSections() && pinnedSections.sections.values.contains(.alwaysHidden)) + return hasSection && alwaysHiddenSeparatorHidden + } + + // Pinned sections hide the always-hidden section again at every collapse, + // so an expand never shows it unless Option-click revealed it since (#224). + func separatorsHiddenForCollapse(current: Bool) -> Bool { + return pinsSections() ? true : current } // Where macOS 27 knows an app by its bundle id: /Applications (and folders @@ -344,11 +369,21 @@ final class NativeVisibilityEngine: MenuBarEngine { } else { self.lastCompleteLayout = layout } - self.sectionMemory.sections.merge(layout.sections) { _, read in read } + if self.pinsSections() { + var observed = self.sectionMemory.sections + var table = self.pinnedSections.sections + layout.sections = PinnedSectionResolver.resolve(read: layout.sections, + launchedSinceRead: self.launchedSinceRead, + observed: &observed, table: &table) + self.sectionMemory.sections = observed + self.pinnedSections.sections = table + } else { + self.sectionMemory.sections.merge(layout.sections) { _, read in read } + } self.launchedSinceRead.subtract(layout.sections.keys) for bundle in self.launchedSinceRead { // Started, but its icon was not listed yet. - layout.sections[bundle] = self.sectionMemory.sections[bundle] ?? .visible + layout.sections[bundle] = self.rememberedSection(of: bundle) } NSLog("NativeVisibility: arrow at x=\(boundary.midX); visible \(layout.bundles(in: [.visible])), hidden \(layout.bundles(in: [.hidden])), always hidden \(layout.bundles(in: [.alwaysHidden]))") if !layout.unnameableVisibleItems.isEmpty || !layout.unprovenVisibleSystemItems.isEmpty { @@ -548,18 +583,19 @@ final class NativeVisibilityEngine: MenuBarEngine { } private func observeLaunches() { - guard let center = workspaceNotifications else { return } func bundle(_ note: Notification) -> String? { return (note.userInfo?[NSWorkspace.applicationUserInfoKey] as? NSRunningApplication)?.bundleIdentifier } - workspaceObservers = [ - center.addObserver(forName: NSWorkspace.didLaunchApplicationNotification, object: nil, queue: .main) { [weak self] note in - bundle(note).map { self?.applicationLaunched($0) } - }, - center.addObserver(forName: NSWorkspace.didTerminateApplicationNotification, object: nil, queue: .main) { [weak self] note in - bundle(note).map { self?.applicationTerminated($0) } - } - ] + for center in [workspaceNotifications, agentLaunches].compactMap({ $0 }) { + workspaceObservers += [ + (center, center.addObserver(forName: NSWorkspace.didLaunchApplicationNotification, object: nil, queue: .main) { [weak self] note in + bundle(note).map { self?.applicationLaunched($0) } + }), + (center, center.addObserver(forName: NSWorkspace.didTerminateApplicationNotification, object: nil, queue: .main) { [weak self] note in + bundle(note).map { self?.applicationTerminated($0) } + }) + ] + } } // A held restriction allows only the apps it was given, so an app that @@ -572,11 +608,41 @@ final class NativeVisibilityEngine: MenuBarEngine { !MenuBarLayoutResolver.systemItemOwners.contains(bundle) else { return } launchedSinceRead.insert(bundle) guard var layout = layout, layout.sections[bundle] == nil else { return } - layout.sections[bundle] = sectionMemory.sections[bundle] ?? .visible + layout.sections[bundle] = rememberedSection(of: bundle) self.layout = layout allowLaunchedAppsIfIdle() } + // The section of an app no read lists yet: its pinned one with the beta on, + // else where it was last read; visible when neither knows it. + private func rememberedSection(of bundle: String) -> MenuBarSection { + if pinsSections() { + return pinnedSections.sections[bundle] ?? PinnedSectionResolver.newAppSection + } + return sectionMemory.sections[bundle] ?? .visible + } + + // Preferences changed the pinned sections: apply them to the held + // restriction at once. A collapse or expand in flight applies them when it + // lands. Apps no read listed yet keep the section they were given. + func pinnedSectionsDidChange() { + guard pinsSections(), var layout = layout else { return } + let table = pinnedSections.sections + for bundle in layout.sections.keys { + if let pinned = table[bundle] { layout.sections[bundle] = pinned } + } + self.layout = layout + NSLog("NativeVisibility: pinned sections changed; visible \(layout.bundles(in: [.visible])), hidden \(layout.bundles(in: [.hidden])), always hidden \(layout.bundles(in: [.alwaysHidden]))") + switch state { + case .collapsed: + allowLaunchedAppsIfIdle() + case .expanded: + applyExpandedPresentation() + case .calibrating, .unavailable: + break + } + } + func applicationTerminated(_ bundle: String) { launchedSinceRead.remove(bundle) } @@ -660,6 +726,47 @@ final class NativeVisibilityEngine: MenuBarEngine { } } +// NSWorkspace posts didLaunch/didTerminateApplication only for apps with a +// Dock icon, and most menu-bar apps are agents (LSUIElement) it skips. Watching +// runningApplications sees every app; this posts the agents' starts and quits +// as those same notifications. Apps with a Dock icon are left to NSWorkspace, +// so no start is reported twice or out of order. +final class AgentLaunchNotifications: NotificationCenter, @unchecked Sendable { + private var observation: NSKeyValueObservation? + + init(workspace: NSWorkspace = .shared, isActive: @escaping () -> Bool) { + super.init() + observation = workspace.observe(\.runningApplications, options: [.old, .new]) { [weak self] _, change in + guard let self = self, isActive() else { return } + let notes = Self.notifications(kind: change.kind, inserted: change.newValue ?? [], removed: change.oldValue ?? [], + isAgent: { $0.activationPolicy != .regular }) + DispatchQueue.main.async { + for (name, app) in notes { + self.post(name: name, object: nil, userInfo: [NSWorkspace.applicationUserInfoKey: app]) + } + } + } + } + + // Reported with or without pinned sections: without them, the launch + // handling for apps that start while collapsed (#446) misses every agent. + static func isActive(pinnedSectionsEnabled: Bool) -> Bool { + return true + } + + static func notifications(kind: NSKeyValueChange, inserted: [App], removed: [App], + isAgent: (App) -> Bool) -> [(Notification.Name, App)] { + switch kind { + case .insertion: + return inserted.filter(isAgent).map { (NSWorkspace.didLaunchApplicationNotification, $0) } + case .removal: + return removed.filter(isAgent).map { (NSWorkspace.didTerminateApplicationNotification, $0) } + default: + return [] + } + } +} + extension Notification.Name { // Posted on the main queue when NativeVisibilityEngine.knownUnkeepableSystemItems changes. static let unkeepableSystemItemsChanged = Notification.Name("unkeepableSystemItemsChanged") @@ -693,7 +800,11 @@ extension NativeVisibilityEngine { "debugAlwaysHiddenX": Self.debugAlwaysHiddenX.map { Double($0) } ?? NSNull(), "clockTimeline": ClockFlashTimeline.snapshot, "notificationCenterSession": ["active": notificationCenter.isActive, - "expandedBar": notificationCenter.expandedBar] + "expandedBar": notificationCenter.expandedBar], + "pinsSections": pinsSections(), + "pinnedSections": pinnedSections.sections.mapValues { String(describing: $0) }, + "observedSections": sectionMemory.sections.mapValues { String(describing: $0) }, + "launchedSinceRead": launchedSinceRead.sorted() ] } diff --git a/hidden/Features/StatusBar/Layout/MenuBarLayout.swift b/hidden/Features/StatusBar/Layout/MenuBarLayout.swift index 20e57922..1b562d1d 100644 --- a/hidden/Features/StatusBar/Layout/MenuBarLayout.swift +++ b/hidden/Features/StatusBar/Layout/MenuBarLayout.swift @@ -112,6 +112,106 @@ final class UserDefaultsSectionMemory: MenuBarSectionMemory { } } +// Pinned sections (beta, macOS 27 direct build): the section the user chose +// for each app, which macOS's placement of a new or relaunched icon no longer +// changes. Until it is first written it reads as the sections each app was +// last read in, so turning the beta on keeps every app where it was. +final class UserDefaultsPinnedSections: MenuBarSectionMemory { + static let key = "pinnedSections" + private let defaults: UserDefaults + + init(defaults: UserDefaults = .standard) { + self.defaults = defaults + } + + var sections: [String: MenuBarSection] { + get { + guard let stored = defaults.dictionary(forKey: Self.key) as? [String: Int] else { + return UserDefaultsSectionMemory(defaults: defaults).sections + } + return stored.compactMapValues(MenuBarSection.init(rawValue:)) + } + set { + defaults.set(newValue.mapValues(\.rawValue), forKey: Self.key) + } + } +} + +enum PinnedSectionResolver { + // Where an app that starts with no pinned section goes. + static let newAppSection: MenuBarSection = .visible + + // Turns one read of the bar into the sections to apply, and edits the table + // from it. A position is the user's choice only when it changed since the + // app was last read and the app did not start meanwhile: macOS puts a new + // or relaunched icon far left, wherever the user had it. `observed` is the + // section each app was last read in; it follows every read. + static func resolve(read: [String: MenuBarSection], + launchedSinceRead: Set, + observed: inout [String: MenuBarSection], + table: inout [String: MenuBarSection]) -> [String: MenuBarSection] { + var resolved: [String: MenuBarSection] = [:] + for (bundle, position) in read { + let launched = launchedSinceRead.contains(bundle) + let moved = observed[bundle].map { $0 != position } ?? false + switch table[bundle] { + case nil: + table[bundle] = launched ? newAppSection : position + case .some(_) where moved && !launched: + table[bundle] = position + case .some: + break + } + observed[bundle] = position + resolved[bundle] = table[bundle] + } + return resolved + } + + static func resetAllToVisible(_ table: [String: MenuBarSection]) -> [String: MenuBarSection] { + return table.mapValues { _ in .visible } + } +} + +// Edits from Preferences (and the debug hooks). The engine applies them when +// the controller passes on `.pinnedSectionsChanged`. +enum PinnedSectionEdits { + static func set(_ section: MenuBarSection, for bundle: String, in table: MenuBarSectionMemory) { + table.sections[bundle] = section + NotificationCenter.default.post(name: .pinnedSectionsChanged, object: nil) + } + + static func resetAllToVisible(in table: MenuBarSectionMemory) { + table.sections = PinnedSectionResolver.resetAllToVisible(table.sections) + NotificationCenter.default.post(name: .pinnedSectionsChanged, object: nil) + } +} + +// The rows of the Preferences "Menu bar apps" list: every app the table +// knows, by name. `name` is nil for an app that is not installed any more. +enum PinnedSectionsList { + struct Entry: Equatable { + let bundle: String + let name: String + let section: MenuBarSection + } + + static func entries(table: [String: MenuBarSection], name: (String) -> String?) -> [Entry] { + return table.map { bundle, section in + let label = bundle == MenuBarLayoutResolver.systemExtrasBundle ? "macOS extras (Focus, Now Playing...)" : (name(bundle) ?? bundle) + return Entry(bundle: bundle, name: label, section: section) + }.sorted { + let order = $0.name.localizedCaseInsensitiveCompare($1.name) + return order == .orderedSame ? $0.bundle < $1.bundle : order == .orderedAscending + } + } +} + +extension Notification.Name { + // Posted on the main queue after Preferences edited the pinned sections. + static let pinnedSectionsChanged = Notification.Name("pinnedSectionsChanged") +} + struct MenuBarLayout: Equatable { // One section per owning bundle, because hiding is per bundle. var sections: [String: MenuBarSection] diff --git a/hidden/Features/StatusBar/StatusBarController.swift b/hidden/Features/StatusBar/StatusBarController.swift index f40bc57e..ee3abe2e 100644 --- a/hidden/Features/StatusBar/StatusBarController.swift +++ b/hidden/Features/StatusBar/StatusBarController.swift @@ -49,6 +49,7 @@ class StatusBarController: MenuBarItemProvider { private var isToggle = false private var hoverMonitor: Any? + private var pinnedSectionsObserver: NSObjectProtocol? private var hoverDwellTimer: Timer? // True while the pointer sits in any screen's menubar band (the strip between @@ -101,6 +102,7 @@ class StatusBarController: MenuBarItemProvider { deinit { NotificationCenter.default.removeObserver(self) + pinnedSectionsObserver.map(NotificationCenter.default.removeObserver) hoverDwellTimer?.invalidate() if let monitor = hoverMonitor { NSEvent.removeMonitor(monitor) @@ -164,6 +166,9 @@ class StatusBarController: MenuBarItemProvider { native.expandBar = { [weak self] in self?.expandMenubar() } native.collapseBar = { [weak self] in self?.collapseMenuBar() } native.expandBarForCapture = { [weak self] in self?.expandMenubar(activatingApp: false) } + pinnedSectionsObserver = NotificationCenter.default.addObserver(forName: .pinnedSectionsChanged, object: nil, queue: .main) { [weak native] _ in + native?.pinnedSectionsDidChange() + } } } @@ -312,6 +317,10 @@ class StatusBarController: MenuBarItemProvider { autoCollapseIfNeeded() return } + if !Preferences.areSeparatorsHidden + && menuBarEngine.separatorsHiddenForCollapse(current: Preferences.areSeparatorsHidden) { + hideSeparators() + } menuBarEngine.collapse { [weak self] result in guard let self = self else { return } @@ -432,6 +441,12 @@ class StatusBarController: MenuBarItemProvider { prefItem.target = self menu.addItem(prefItem) + if menuBarEngine.offersShowEverything { + let showEverythingItem = NSMenuItem(title: "Show Everything".localized, action: #selector(showEverything), keyEquivalent: "") + showEverythingItem.target = self + menu.addItem(showEverythingItem) + } + let toggleAutoHideTitle = Preferences.isAutoHide ? "Disable Auto Collapse" : "Enable Auto Collapse" let toggleAutoHideItem = NSMenuItem(title: toggleAutoHideTitle.localized, action: #selector(toggleAutoHide), keyEquivalent: "t") toggleAutoHideItem.target = self @@ -468,6 +483,16 @@ class StatusBarController: MenuBarItemProvider { @objc func toggleAutoHide() { Preferences.isAutoHide.toggle() } + + // Expands the bar with the always-hidden section shown, until the next + // collapse hides it again. The way back to icons lost there (#242). + @objc func showEverything() { + menuBarEngine.userChangedBar() + if Preferences.areSeparatorsHidden { + showSeparators() + } + expandMenubar() + } } @@ -561,6 +586,22 @@ extension StatusBarController { menuBarEngine.invalidateLayout() case "install-location-check": NativeVisibilityEngine.debugChecksInstallLocation = argument == "on" + case "pinned-sections": + // What the Preferences checkbox runs. + Preferences.pinnedSectionsEnabled = argument == "on" + case "pin": + // What a Preferences "Menu bar apps" row runs: "=visible|hidden|alwaysHidden". + let parts = (argument ?? "").components(separatedBy: "=") + let sections: [String: MenuBarSection] = ["visible": .visible, "hidden": .hidden, "alwaysHidden": .alwaysHidden] + if parts.count == 2, let section = sections[parts[1]] { + PinnedSectionEdits.set(section, for: parts[0], in: UserDefaultsPinnedSections()) + } + case "reset-pinned": + // What the Preferences "Reset all to visible" button runs. + PinnedSectionEdits.resetAllToVisible(in: UserDefaultsPinnedSections()) + case "show-everything": + // What the arrow menu's "Show Everything" runs. + showEverything() case "click-clock": debugClickClock(pressingWithAX: argument == "ax") case "dump-state": diff --git a/hidden/ar.lproj/Localizable.strings b/hidden/ar.lproj/Localizable.strings index 97166f40..df75f777 100644 --- a/hidden/ar.lproj/Localizable.strings +++ b/hidden/ar.lproj/Localizable.strings @@ -117,3 +117,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/de.lproj/Localizable.strings b/hidden/de.lproj/Localizable.strings index aef8c53d..07b38d4b 100644 --- a/hidden/de.lproj/Localizable.strings +++ b/hidden/de.lproj/Localizable.strings @@ -116,3 +116,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/en.lproj/Localizable.strings b/hidden/en.lproj/Localizable.strings index 02e0f0a9..930bf136 100644 --- a/hidden/en.lproj/Localizable.strings +++ b/hidden/en.lproj/Localizable.strings @@ -153,3 +153,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/fr.lproj/Localizable.strings b/hidden/fr.lproj/Localizable.strings index 23d838ee..5c3a0aac 100644 --- a/hidden/fr.lproj/Localizable.strings +++ b/hidden/fr.lproj/Localizable.strings @@ -118,3 +118,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/hr.lproj/Localizable.strings b/hidden/hr.lproj/Localizable.strings index 9e4bcc74..286c96c1 100644 --- a/hidden/hr.lproj/Localizable.strings +++ b/hidden/hr.lproj/Localizable.strings @@ -116,3 +116,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/it.lproj/Localizable.strings b/hidden/it.lproj/Localizable.strings index b6a99516..74e4ae16 100644 --- a/hidden/it.lproj/Localizable.strings +++ b/hidden/it.lproj/Localizable.strings @@ -118,3 +118,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/ja.lproj/Localizable.strings b/hidden/ja.lproj/Localizable.strings index 8c307922..781a76cb 100644 --- a/hidden/ja.lproj/Localizable.strings +++ b/hidden/ja.lproj/Localizable.strings @@ -115,3 +115,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/pl.lproj/Localizable.strings b/hidden/pl.lproj/Localizable.strings index 36be40e7..db9f224d 100644 --- a/hidden/pl.lproj/Localizable.strings +++ b/hidden/pl.lproj/Localizable.strings @@ -116,3 +116,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/tr.lproj/Localizable.strings b/hidden/tr.lproj/Localizable.strings index 31ac52bf..1fae4046 100644 --- a/hidden/tr.lproj/Localizable.strings +++ b/hidden/tr.lproj/Localizable.strings @@ -117,3 +117,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/uk.lproj/Localizable.strings b/hidden/uk.lproj/Localizable.strings index a40011b1..5cbf7cc2 100644 --- a/hidden/uk.lproj/Localizable.strings +++ b/hidden/uk.lproj/Localizable.strings @@ -116,3 +116,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/vi.lproj/Localizable.strings b/hidden/vi.lproj/Localizable.strings index 64640905..fda347f9 100644 --- a/hidden/vi.lproj/Localizable.strings +++ b/hidden/vi.lproj/Localizable.strings @@ -116,3 +116,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/zh-Hans.lproj/Localizable.strings b/hidden/zh-Hans.lproj/Localizable.strings index cfe68032..e287809f 100644 --- a/hidden/zh-Hans.lproj/Localizable.strings +++ b/hidden/zh-Hans.lproj/Localizable.strings @@ -118,3 +118,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything"; diff --git a/hidden/zh-Hant.lproj/Localizable.strings b/hidden/zh-Hant.lproj/Localizable.strings index c457245d..bf965b1c 100644 --- a/hidden/zh-Hant.lproj/Localizable.strings +++ b/hidden/zh-Hant.lproj/Localizable.strings @@ -124,3 +124,18 @@ Steps to view always hidden icons: "Free and open source, MIT license." = "Free and open source, MIT license."; "Follow @dwarvesf on X" = "Follow @dwarvesf on X"; "Made by Dwarves Foundation" = "Made by Dwarves Foundation"; + +/* Pinned sections (beta), Menu Bar Apps; English until translated */ +"Pinned sections (beta)" = "Pinned sections (beta)"; +"Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse." = "Keeps each app in the section you pick in Menu Bar Apps, also after it restarts. Applies at the next collapse."; +"Turn On" = "Turn On"; +"Pinned sections is off" = "Pinned sections is off"; +"Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app." = "Icons follow where macOS puts them. Turn on Pinned sections (beta) in Advanced to choose a section for each app."; +"Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too." = "Each app stays in the section you pick, also after it restarts. ⌘-dragging an icon across the arrow moves it too."; +"No apps yet" = "No apps yet"; +"Apps with a menu bar icon appear here after the bar collapses once." = "Apps with a menu bar icon appear here after the bar collapses once."; +"Reset" = "Reset"; +"Reset all to visible" = "Reset all to visible"; +"Shows every app, including ones that are not running now." = "Shows every app, including ones that are not running now."; +"Visible" = "Visible"; +"Show Everything" = "Show Everything";