Skip to content

Instantly share code, notes, and snippets.

@phildier
Created January 4, 2019 16:16
Show Gist options
  • Select an option

  • Save phildier/7577ab0283fb401aa5f19d381c52d195 to your computer and use it in GitHub Desktop.

Select an option

Save phildier/7577ab0283fb401aa5f19d381c52d195 to your computer and use it in GitHub Desktop.
Displays the time in various timezones on the xwindows background image
#!/bin/bash
export PATH=/bin:/usr/bin
DISPLAY=":0.0"
FONT=Courier-10-Pitch
FORMAT="%Z (UTC%z) %a %b %e %H:%M"
SIZE=$(
xwininfo -display "$DISPLAY" -root \
| awk '/Width:/{width=$2}; /Height:/{height=$2} END { print width"x"height }'
)
LABEL=$(
TZ=America/Los_Angeles date +"$FORMAT"
TZ=America/Chicago date +"$FORMAT"
TZ=America/New_York date +"$FORMAT"
TZ=UTC date +"$FORMAT"
TZ=EET date +"$FORMAT"
)
convert \
-size "$SIZE" \
-background black \
-fill lightgray \
-font $FONT \
-gravity southwest \
-pointsize 22 \
label:"$LABEL" \
jpg:- \
| xloadimage -display "$DISPLAY" -onroot stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment