[macOS 27 / PR #995] An app launched while concealed gets a squashed (3 pt) menu bar item that never recovers

#1007 · open · 1 comments

View on GitHub ↗

Theralley

Follow-up to #1006. Reproducible on macOS 27.0.1 (26A434) with #995 at `15f59a9`. **What happens** If an app in the hidden section is launched while Ice holds its concealment assertion, the app's status item comes back 3 pt wide when revealed: a clipped sliver of its icon, overlapping the item beside it. It stays that way after Ice quits and after relaunching the app. Only relaunching the app while Ice is not running fixes it. **Steps** 1. Put AlDente (`com.apphousekitchen.aldente-pro`) in the hidden section, start Ice. The item is 18 pt (Accessibility `AXMenuExtra` width). 2. Quit AlDente and open it again while Ice is running. 3. The item is now 3 pt. Revealing does not fix it, quitting Ice does not fix it, relaunching AlDente does not fix it. 4. Fix: quit Ice and AlDente, open AlDente, then Ice. Back to 18 pt. **Not every app.** Amphetamine relaunched the same way keeps its 33 pt width. AlDente probably uses a variable-length item that sizes itself from the space it is offered at creation, and gets zero while concealed. So any variable-length item is likely affected. **Why it matters:** Login Items start in their own order. With Ice before such an app, its item is squashed on every boot. I work around it with a LaunchAgent that opens Ice only after AlDente is running. **Possible fix:** when an application in a concealed section launches, release it from the assertion briefly, until its status item has been created and sized, then conceal it again. `Concealer27` already observes `didLaunchApplicationNotification`.

Comments

Theralley

I have a fix for this, tested on macOS 27.0.1, and opened it as a PR against the #995 branch: https://github.com/RabenkoYevhenii/Ice/pull/2 It sits on top of `15f59a9` and only adds code to one file, `Concealer27.swift`. When an app from the hidden section launches, Ice shows it until its status item exists at a real width, for 8 s at most, and then conceals it again. It reuses `showTemporarily` and `endTemporaryShow`. My first attempt hooked `didLaunchApplicationNotification`, and AlDente still came up at 3 pt. That notification arrives after the app has finished launching, and by then the item already exists. The commit observes `NSWorkspace.shared.runningApplications` with KVO instead, which changes as soon as the process checks in. From the log of a run with the fix: ``` 15:30:13.316 Ice Showing launching com.apphousekitchen.aldente-pro until its item exists 15:30:13.714 AlDente [AppKit:StatusBar] set up scene 15:30:14.320 Ice Concealing com.apphousekitchen.aldente-pro again, item width 18 ``` So Ice gets in 400 ms before AlDente creates its item. I relaunched AlDente under Ice three times and got 18 pt each time, against 3 pt without the fix. Amphetamine stays at 33 pt. The cost is that a hidden app shows for about a second after it launches, which seems fair to me. One gap: an app in the hidden section that has no status item at all stays visible for the full 8 s. That could be shortened, but I kept the change small.