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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Fixed
- Test runs no longer read or write Hidden Bar's real preferences or act on the installed app. A test host uses its own preferences suite, and skips the "Move to Applications" offer, the App Store migration prompts, Sparkle and the saved arrow positions, so a test run cannot trash or move the installed copy.
- macOS 27 (direct build): Little Snitch's icon no longer hides on every collapse. Little Snitch turns Accessibility off for its apps, so Hidden Bar could not see its icon, left it off the list of apps to keep, and macOS hid it wherever it sat. Hidden Bar now keeps an app it cannot see visible, as it does for an app that does not answer. Its position stays unknown, so to hide it, set it to Hidden in Settings › Icons. This likely also covers [#514](https://github.com/dwarvesf/hidden/issues/514), whose app was not identified ([#502](https://github.com/dwarvesf/hidden/issues/502)).
- Upgrading from a version before 1.11 (the GitHub builds up to 1.10 or the App Store build) no longer leaves the old "LauncherApplication" login item behind. System Settings › General › Login Items & Extensions lists it inside "Hidden Bar" under Allow in the Background, not as a row of its own, and the old cleanup failed on every launch. Now, with "Open Hidden Bar at login" on, Hidden Bar turns its login item off and on once, which removes the old one. With it off, nothing is touched until you turn it on. If the cleanup fails, the log says once where the row is and how to remove it ([#456](https://github.com/dwarvesf/hidden/issues/456)).

## v1.13.0 (2026-11-16)
Expand Down
43 changes: 43 additions & 0 deletions HiddenBarTests/MenuBarEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,19 @@ final class PinnedSectionsTests: XCTestCase {
XCTAssertEqual(collapse(engine), [own, "com.visible"])
}

// Given an app whose icons Accessibility cannot place (Little Snitch, #502)
// When it is new, it shows on collapse; once Settings › Icons pins it hidden, it hides
// Then its unknown position never overrides the pinned choice
func testAnUnplaceableAppShowsUntilPinnedHidden() {
inventory.items.append(MenuBarInventoryItem(bundleIdentifier: "at.obdev.littlesnitch.agent", frame: .zero, isUnreadable: true))
let engine = makeEngine()
XCTAssertEqual(collapse(engine), [own, "at.obdev.littlesnitch.agent", "com.visible"])
engine.expand()
table.sections["at.obdev.littlesnitch.agent"] = .hidden
XCTAssertEqual(collapse(engine), [own, "com.visible"])
XCTAssertEqual(table.sections["at.obdev.littlesnitch.agent"], .hidden)
}

// Given an app that recreates its status item without relaunching (BitBar, SwiftBar)
// When "Ignore drags" is on for it and its icon lands on the hidden side
// Then it stays in its pinned section; an app without the flag still follows the move
Expand Down Expand Up @@ -2267,6 +2280,36 @@ final class AccessibilityInventoryRetryTests: XCTestCase {
XCTAssertEqual(items.map(\.isUnreadable), [false, true, false])
}

// #502: Little Snitch answers Accessibility with a frame and nothing else, so
// none of its items is listed. It must be kept visible, not dropped and hidden.
func testAnAppThatRefusesAccessibilityIsKeptVisibleWithoutAReread() {
let lock = NSLock()
var calls = 0
var unanswered: [Int] = []
let items = AccessibilityMenuBarInventory.collect(count: 3, read: { index, _ in
if index != 1 { return .items([self.item("app\(index)", x: CGFloat(index) * 30)]) }
lock.lock(); calls += 1; lock.unlock()
return .refused
}, unanswered: { index in
unanswered.append(index)
return [MenuBarInventoryItem(bundleIdentifier: "at.obdev.littlesnitch.agent", frame: .zero, isUnreadable: true)]
})
XCTAssertEqual(calls, 1, "a refusal is an answer: no re-read")
XCTAssertEqual(unanswered, [1])
XCTAssertEqual(items.map(\.bundleIdentifier), ["app0", "at.obdev.littlesnitch.agent", "app2"])
XCTAssertEqual(items.map(\.isUnreadable), [false, true, false])
}

func testOnlyAnAppElementWithoutARoleRefusesAccessibility() {
// Little Snitch and its agent on 27.2.
XCTAssertTrue(AccessibilityMenuBarInventory.refusesAccessibility(attributeNames: ["AXFrame", "AXSize", "AXPosition"]))
XCTAssertTrue(AccessibilityMenuBarInventory.refusesAccessibility(attributeNames: []))
// Finder, which has no menu-bar item and answers AXExtrasMenuBar with no value.
XCTAssertFalse(AccessibilityMenuBarInventory.refusesAccessibility(attributeNames: ["AXRole", "AXRoleDescription", "AXTitle", "AXChildren"]))
// The attribute names could not be read: nothing is known, nothing is added.
XCTAssertFalse(AccessibilityMenuBarInventory.refusesAccessibility(attributeNames: nil))
}

func testNoRereadWhenEveryAppAnswers() {
let lock = NSLock()
var calls = 0
Expand Down
3 changes: 3 additions & 0 deletions hidden/Features/StatusBar/Engine/NativeVisibilityEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import AppKit
// SystemUIServer's legacy Menu Extras (Time Machine...) are the exception:
// none was observed with a system item identifier, so they are sectioned
// per bundle instead.
// - An app that turns Accessibility off (Little Snitch) cannot be placed: its
// icons count as visible wherever they sit, like an app that never answers.
// With pinned sections on, Settings › Icons can still hide it.
// - Sections are read only while nothing is hidden, because hidden items report
// stale positions. They are re-read on the next collapse from an unrestricted
// bar. An app that starts while something is hidden is not in the read, so it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ final class AccessibilityMenuBarInventory: MenuBarInventoryProviding {
case items([MenuBarInventoryItem])
// The app did not answer within the messaging timeout.
case timedOut
// The app answers but exposes no Accessibility tree, so its items and
// their positions cannot be read. Not read again.
case refused
}

// An app element that lists attributes but not even a role has turned its
// Accessibility off (Little Snitch on 27.2 lists only a frame); any AppKit or
// SwiftUI app lists its role, whether or not it has menu-bar items.
static func refusesAccessibility(attributeNames: [String]?) -> Bool {
guard let names = attributeNames else { return false }
return !names.contains(kAXRoleAttribute as String)
}

// Each app is an independent IPC round-trip, so they run concurrently; serial
Expand All @@ -74,8 +85,12 @@ final class AccessibilityMenuBarInventory: MenuBarInventoryProviding {
return collect(count: apps.count,
read: { index, timeout in read(apps[index], timeout: timeout) },
unanswered: { index in
// Unknown items stay visible. Without a bundle id nothing
// could be allowed anyway, and such processes are mostly daemons.
// Unknown items stay visible, wherever they sit: an app that
// never answered, or one that answers but shows Accessibility
// nothing (Little Snitch, #502), which otherwise is left out of
// the allow list and hidden on every collapse. Without a bundle
// id nothing could be allowed anyway, and such processes are
// mostly daemons.
let app = apps[index]
guard app.bundleIdentifier != nil else { return [] }
return [MenuBarInventoryItem(bundleIdentifier: app.bundleIdentifier, frame: .zero,
Expand All @@ -86,8 +101,8 @@ final class AccessibilityMenuBarInventory: MenuBarInventoryProviding {
// Reads every app concurrently with the short timeout, then reads the apps
// that timed out once more with the longer one. Under concurrent load a slow
// app can miss the short timeout; dropping it would hide it on collapse even
// when it sits in the visible section. An app that times out twice gets the
// items `unanswered` returns for it.
// when it sits in the visible section. An app that times out twice, or that
// refuses Accessibility, gets the items `unanswered` returns for it.
static func collect(count: Int, read: (Int, Float) -> AppRead,
unanswered: (Int) -> [MenuBarInventoryItem]) -> [MenuBarInventoryItem] {
var results = [AppRead](repeating: .items([]), count: count)
Expand Down Expand Up @@ -124,7 +139,11 @@ final class AccessibilityMenuBarInventory: MenuBarInventoryProviding {
var barValue: CFTypeRef?
let barError = AXUIElementCopyAttributeValue(element, "AXExtrasMenuBar" as CFString, &barValue)
if barError == .cannotComplete { return .timedOut }
guard barError == .success, let bar = barValue else { return .items([]) }
guard barError == .success, let bar = barValue else {
var names: CFArray?
let namesError = AXUIElementCopyAttributeNames(element, &names)
return refusesAccessibility(attributeNames: namesError == .success ? names as? [String] : nil) ? .refused : .items([])
}
var childrenValue: CFTypeRef?
let childrenError = AXUIElementCopyAttributeValue(bar as! AXUIElement, kAXChildrenAttribute as CFString, &childrenValue)
if childrenError == .cannotComplete { return .timedOut }
Expand Down