Revert "Hide menu bar icons with a cover instead of moving them off screen"
This reverts commit 3e57efe312.
This commit is contained in:
@@ -103,9 +103,9 @@ func runSelfTest() {
|
||||
check(MenuBarItemManager.children(of: systemWide) == nil, "no children on a non-app element")
|
||||
|
||||
let element = AXUIElementCreateSystemWide()
|
||||
let first = MenuBarItem(id: "1-0", pid: 1, appName: "A", title: "T", icon: NSImage(), frame: nil, element: element)
|
||||
let same = MenuBarItem(id: "1-0", pid: 1, appName: "A", title: "T", icon: NSImage(), frame: nil, element: element)
|
||||
let different = MenuBarItem(id: "1-1", pid: 1, appName: "A", title: "T", icon: NSImage(), frame: nil, element: element)
|
||||
let first = MenuBarItem(id: "1-0", pid: 1, appName: "A", title: "T", icon: NSImage(), element: element)
|
||||
let same = MenuBarItem(id: "1-0", pid: 1, appName: "A", title: "T", icon: NSImage(), element: element)
|
||||
let different = MenuBarItem(id: "1-1", pid: 1, appName: "A", title: "T", icon: NSImage(), element: element)
|
||||
check(first == same, "menu bar items compare by id and title")
|
||||
check(first != different, "different ids are not equal")
|
||||
|
||||
@@ -117,27 +117,6 @@ func runSelfTest() {
|
||||
check(MenuBarItemManager.symbolName(for: "Search") == "magnifyingglass", "search maps to magnifier symbol")
|
||||
check(MenuBarItemManager.symbolName(for: "cmux") == nil, "unknown titles fall back to the app icon")
|
||||
|
||||
// Cover geometry: adjacent icons merge into one run, far ones stay separate.
|
||||
let merged = MenuBarCover.runs(from: [CGRect(x: 0, y: 0, width: 10, height: 20),
|
||||
CGRect(x: 12, y: 0, width: 10, height: 20)])
|
||||
check(merged == [CGRect(x: 0, y: 0, width: 22, height: 20)], "adjacent frames merge into one cover")
|
||||
let split = MenuBarCover.runs(from: [CGRect(x: 0, y: 0, width: 10, height: 20),
|
||||
CGRect(x: 100, y: 0, width: 10, height: 20)])
|
||||
check(split.count == 2, "distant frames stay separate covers")
|
||||
|
||||
// Cover hides third-party apps but keeps the Apple items.
|
||||
let hiddenApp = MenuBarItem(id: "1-0", pid: 1, appName: "cmux", title: "cmux", icon: NSImage(), frame: nil, element: element)
|
||||
let keptWiFi = MenuBarItem(id: "2-0", pid: 2, appName: "Control Center", title: "Wi\u{2011}Fi, connected", icon: NSImage(), frame: nil, element: element)
|
||||
let keptBattery = MenuBarItem(id: "2-1", pid: 2, appName: "Control Center", title: "Battery", icon: NSImage(), frame: nil, element: element)
|
||||
let hiddenPlaying = MenuBarItem(id: "2-2", pid: 2, appName: "Control Center", title: "Now Playing", icon: NSImage(), frame: nil, element: element)
|
||||
check(MenuBarCover.shouldHide(hiddenApp), "third-party apps are covered")
|
||||
check(!MenuBarCover.shouldHide(keptWiFi), "wi-fi stays visible")
|
||||
check(!MenuBarCover.shouldHide(keptBattery), "battery stays visible")
|
||||
check(MenuBarCover.shouldHide(hiddenPlaying), "now playing is covered")
|
||||
|
||||
let converted = MenuBarCover.windowFrame(for: CGRect(x: 10, y: 0, width: 30, height: 24), primaryHeight: 1000)
|
||||
check(converted == CGRect(x: 10, y: 976, width: 30, height: 24), "AX frame flips Y for NSWindow")
|
||||
|
||||
let authorized = AXIsProcessTrusted()
|
||||
print("accessibility authorized=\(authorized)")
|
||||
if authorized {
|
||||
|
||||
Reference in New Issue
Block a user