Skip to content

Fix multiple macOS compatibility bugs - #281

Open
sclarkca wants to merge 3 commits into
gao-sun:masterfrom
sclarkca:fix/macos-compatibility-bugs
Open

sclarkca wants to merge 3 commits into
gao-sun:masterfrom
sclarkca:fix/macos-compatibility-bugs

Conversation

@sclarkca

Copy link
Copy Markdown

Summary

Fixes several bugs related to newer macOS compatibility:

Files Changed

  • eul/Store/TopStore.swift - Parse rsize unit suffixes (K/M/G)
  • eul/Store/NetworkStore.swift - Safer counter wrap handling
  • eul/Store/PreferenceStore.swift - Write appearance mode to widget container
  • eul/AppDelegate.swift - Also set NSApp.appearance
  • eul/StatusBar/StatusBarManager.swift - Cleaner visibility logic
  • eul/StatusBar/StatusBarItem.swift - Ensure button allocation
  • SharedLibrary/Schema/PreferenceEntry.swift - Add appearanceMode field
  • SharedLibrary/Schema/StandardProvider.swift - Fix deprecated API availability
  • BatteryWidget/BatteryWidget.swift, CpuWidget/CpuWidget.swift, MemoryWidget/MemoryWidget.swift, NetworkWidget/NetworkWidget.swift - Apply preferred color scheme from preference

913695467@qq.com added 2 commits May 16, 2026 12:49
- Change default disk stats to use root volume "/" instead of summing
  all volumes from /Volumes, which included external drives (fixes gao-sun#250)
- Fix invalid NSRegularExpression pattern "/ +/g" (JS-style) to use
  Swift's split(separator:) directly
- Fix gao-sun#227: Parse top command rsize suffixes (K/M/G) correctly for
  memory process list display
- Fix gao-sun#226: Handle network byte counter wrap without reporting 0 speed
- Fix gao-sun#236: Add appearance mode to widget shared preferences so
  widgets follow eul's theme setting
- Fix gao-sun#246: Set NSApp.appearance alongside window.appearance for
  consistent appearance switching
- Fix gao-sun#271: Improve status bar visibility logic to avoid flickering
  on newer macOS versions
- Fix deprecated OSXApplicationExtension → macOSApplicationExtension
@github-actions github-actions Bot added the needs review PR needs review label May 16, 2026
- Filter ifconfig results to only physical interfaces (en*, ap*)
- Prevent deadlock by adding timeout guard for async network callback
- Fix TopStore memory parsing formatting
- Remove SDKROOT=macosx from SwiftFormat build phase
realhidden pushed a commit to realhidden/eul that referenced this pull request Sep 18, 2026
Idle power (gao-sun#76, gao-sun#87, gao-sun#18):
- New WidgetReloader coalesces WidgetCenter reloads: skipped entirely when no
  widget of the kind is installed (the common case; stores previously woke
  every widget extension process on each 3-5s tick) and throttled to >=15s
  otherwise. Widget entry validity widened 3s -> 45s and the timeline outdated
  window 10s -> 60s to match, so coalesced widgets don't flip to "not
  available". WidgetReloader is now the only WidgetCenter caller (verified).
- AppDelegate: generation counters invalidate pending asyncAfter chains - a
  brief sleep/wake used to leave the old refresh chain running next to the new
  one, multiplying the effective refresh rate after every wake. The hourly
  update-check chain had the same accumulation bug via the upgrade-method
  subscription and gets its own generation.
- SmcControl drops SMC sensors that fail 3 consecutive reads AND have never
  read successfully (the bogus Apple Silicon keys), ending the per-tick error
  log spam without risking removal of a working Intel sensor after a
  wake-time glitch.

Status bar (gao-sun#40, gao-sun#113): StatusBarManager.render no longer toggles isVisible
off/on - that made the system forget the item's saved position, so the bar
jumped to the right end after reboot or component changes. The item is never
fully hidden (it is the only path into Preferences).

Accuracy / robustness (adapted from PR gao-sun#281 with fixes):
- TopStore: parse top's rsize unit suffix; values are KB by default and may
  carry K/M/G plus a +/- growth marker (e.g. "433M+"), so RAM percentages were
  up to 1024x off (gao-sun#227). Suffix lookup ignores the marker (gao-sun#281's version
  mis-parsed "433M+" as KB).
- NetworkStore: treat interface counter resets/wraps as zero speed instead of
  freezing (gao-sun#226); a 10s generation-guarded watchdog re-opens the single-flight
  guard if the shell pipeline never calls back (gao-sun#263) - stale watchdogs can't
  re-open the guard for a younger request, late callbacks are discarded, the
  speed division is guarded against near-zero elapsed, and the watchdog stops
  re-arming after 5 consecutive fires so a persistent hang can't accumulate
  hung processes. Widget reload routed through WidgetReloader.
- DiskStore: with no explicit disk selected report the boot volume
  (volumeAvailableCapacityForImportantUsage, Finder-style) instead of summing
  all volumes - APFS volumes share a container so the sum double-counted
  (gao-sun#250, gao-sun#182). Cached per refresh; negative values guarded.
- Info.getActiveInterfaces: exclude virtual interfaces (lo/awdl/llw/utun/
  gif/stf) that report "active" and shadow the real port (gao-sun#226); exclusion
  rather than an en*/ap* allowlist keeps Thunderbolt/USB bridges working.
- GPU.getInfo: also read "GPU Core Utilization" and IOAcceleratorStatistics2
  (from PR gao-sun#275). NSApp.appearance follows the appearance preference (gao-sun#246).
- splittedByWhitespace: drop the no-op NSRegularExpression.

Deliberately NOT taken from gao-sun#281: widget dark/light theming via
.preferredColorScheme - it is a no-op inside WidgetKit extension views, and
the PreferenceEntry schema change broke decoding of pre-upgrade container
data. gao-sun#236 needs a different mechanism.

All changes adversarially reviewed by a 4-lens multi-agent pass (concurrency,
behavior, API correctness, edge cases); 6 distinct confirmed findings fixed,
including a missed WidgetReloader conversion in NetworkStore. Debug + Release
BUILD SUCCEEDED on Xcode 26.3; live smoke run on Apple Silicon: sensors
cached, active interface resolves to ["en0"], no SMC error spam.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
realhidden pushed a commit to realhidden/eul that referenced this pull request Sep 18, 2026
Idle power (gao-sun#76, gao-sun#87, gao-sun#18):
- New WidgetReloader coalesces WidgetCenter reloads: skipped entirely when no
  widget of the kind is installed (the common case; stores previously woke
  every widget extension process on each 3-5s tick) and throttled to >=15s
  otherwise. Widget entry validity widened 3s -> 45s and the timeline outdated
  window 10s -> 60s to match, so coalesced widgets don't flip to "not
  available". WidgetReloader is now the only WidgetCenter caller (verified).
- AppDelegate: generation counters invalidate pending asyncAfter chains - a
  brief sleep/wake used to leave the old refresh chain running next to the new
  one, multiplying the effective refresh rate after every wake. The hourly
  update-check chain had the same accumulation bug via the upgrade-method
  subscription and gets its own generation.
- SmcControl drops SMC sensors that fail 3 consecutive reads AND have never
  read successfully (the bogus Apple Silicon keys), ending the per-tick error
  log spam without risking removal of a working Intel sensor after a
  wake-time glitch.

Status bar (gao-sun#40, gao-sun#113): StatusBarManager.render no longer toggles isVisible
off/on - that made the system forget the item's saved position, so the bar
jumped to the right end after reboot or component changes. The item is never
fully hidden (it is the only path into Preferences).

Accuracy / robustness (adapted from PR gao-sun#281 with fixes):
- TopStore: parse top's rsize unit suffix; values are KB by default and may
  carry K/M/G plus a +/- growth marker (e.g. "433M+"), so RAM percentages were
  up to 1024x off (gao-sun#227). Suffix lookup ignores the marker (gao-sun#281's version
  mis-parsed "433M+" as KB).
- NetworkStore: treat interface counter resets/wraps as zero speed instead of
  freezing (gao-sun#226); a 10s generation-guarded watchdog re-opens the single-flight
  guard if the shell pipeline never calls back (gao-sun#263) - stale watchdogs can't
  re-open the guard for a younger request, late callbacks are discarded, the
  speed division is guarded against near-zero elapsed, and the watchdog stops
  re-arming after 5 consecutive fires so a persistent hang can't accumulate
  hung processes. Widget reload routed through WidgetReloader.
- DiskStore: with no explicit disk selected report the boot volume
  (volumeAvailableCapacityForImportantUsage, Finder-style) instead of summing
  all volumes - APFS volumes share a container so the sum double-counted
  (gao-sun#250, gao-sun#182). Cached per refresh; negative values guarded.
- Info.getActiveInterfaces: exclude virtual interfaces (lo/awdl/llw/utun/
  gif/stf) that report "active" and shadow the real port (gao-sun#226); exclusion
  rather than an en*/ap* allowlist keeps Thunderbolt/USB bridges working.
- GPU.getInfo: also read "GPU Core Utilization" and IOAcceleratorStatistics2
  (from PR gao-sun#275). NSApp.appearance follows the appearance preference (gao-sun#246).
- splittedByWhitespace: drop the no-op NSRegularExpression.

Deliberately NOT taken from gao-sun#281: widget dark/light theming via
.preferredColorScheme - it is a no-op inside WidgetKit extension views, and
the PreferenceEntry schema change broke decoding of pre-upgrade container
data. gao-sun#236 needs a different mechanism.

All changes adversarially reviewed by a 4-lens multi-agent pass (concurrency,
behavior, API correctness, edge cases); 6 distinct confirmed findings fixed,
including a missed WidgetReloader conversion in NetworkStore. Debug + Release
BUILD SUCCEEDED on Xcode 26.3; live smoke run on Apple Silicon: sensors
cached, active interface resolves to ["en0"], no SMC error spam.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review PR needs review

Projects

None yet

1 participant