Skip to content

Instantly share code, notes, and snippets.

@guimondmm
Created September 25, 2023 22:19
Show Gist options
  • Save guimondmm/e4010b7b78a076220203d6664db880d3 to your computer and use it in GitHub Desktop.
Save guimondmm/e4010b7b78a076220203d6664db880d3 to your computer and use it in GitHub Desktop.
Bartender 4 "show for update" trigger script for Background Sounds (macOS 13 Ventura or newer)
lsof -NPp $(pgrep -xo heard) 2>/dev/null | grep -cm1 com_apple_MobileAsset_ComfortSoundsAssets
@guimondmm
Copy link
Author

Requires Bartender 4 and macOS 13 Ventura or newer.

Display the Hearing Accessibility menu bar icon only when Background Sounds are active:

This simple command returns 1 if any Background Sounds are active (e.g., Balanced Noise, Bright Noise, Dark Noise, Ocean, Rain, Stream, etc.), and 0 otherwise.

  • In System Settings > Control Center, under Hearing, enable Show in Menu Bar.
  • In Bartender Preferences… > Show For Updates, click the + button, select the Hearing menu bar icon, and click the Create Show For Update Trigger button;
  • Select Show when: script returns true as the trigger condition;
  • Paste the command in the Shell Script to run to test if item should show field;
lsof -NPp $(pgrep -xo heard) 2>/dev/null | grep -cm1 com_apple_MobileAsset_ComfortSoundsAssets
  • Set run script every: 15 Seconds and show for: While comparison is true, and click Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment