Skip to content

Instantly share code, notes, and snippets.

@stefanlasiewski
Last active January 7, 2026 02:02
Show Gist options
  • Select an option

  • Save stefanlasiewski/533eb2a7117000232ba21e2b9399e0f3 to your computer and use it in GitHub Desktop.

Select an option

Save stefanlasiewski/533eb2a7117000232ba21e2b9399e0f3 to your computer and use it in GitHub Desktop.
UTC Clock for iTerm2 Status Bar
# iTerm2's Status Bar can show a clock, but the time is in my local timezone
# This script will create a second clock to display UTC on the iTerm2 Status Bar
# Add this to .config/iterm2/AppSupport/Scripts/AutoLaunch/utc_clock.py,
# restart iTerm & add to Preferences > Profiles > Session > Configure Status Bar
import iterm2
from datetime import datetime, timezone
async def main(connection):
component = iterm2.StatusBarComponent(
short_description="UTC Date",
detailed_description="Shows current date/time in UTC",
knobs=[],
exemplar="1/06 12:00 UTC",
#update_cadence=60,
update_cadence=1,
identifier="com.iterm2.example.utc-clock"
)
@iterm2.StatusBarRPC
async def utc_clock_coroutine(knobs):
now = datetime.now(timezone.utc)
return now.strftime("%m/%d %H:%M UTC")
await component.async_register(connection, utc_clock_coroutine)
iterm2.run_forever(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment