{"version":"1.0","type":"rich","title":"toggle dark mode: 🔋 → 🌚 / 🔌 → ☀️","description":"This example demonstrates a macOS automation script that toggles dark mode based on power source, checking every 60 seconds via a LaunchAgent plist. The Bash script uses `pmset` to detect whether the system draws from battery or AC power, and `defaults` to read the current appearance mode (Dark, Light, or Auto). It saves the original mode to a temporary file before enabling dark mode on battery, then reverts to the saved preference when power returns, using `osascript` to control System Events and display notifications. The code also handles Auto mode by writing the appropriate preference via `defaults write`.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-6ec6c675354cad560a4a613630a5e334?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}