/
genmon-vclock
executable file
·38 lines (34 loc) · 1.45 KB
/
genmon-vclock
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Output markup for a vertical clock in an xfce4-genmon-plugin
#
# This was tested with the "Default Font" (Sans Regular 10, I think)
# on a 1920x1080 desktop.
#
# Documentation:
# /usr/share/doc/xfce4-genmon-plugin/README
# https://goodies.xfce.org/projects/panel-plugins/xfce4-genmon-plugin
# https://developer.gnome.org/pango/stable/PangoMarkupFormat.html
#
# Bugs: Some marked-up text doesn't center properly in the vertical,
# including weight='Bold' and size='Large'.
#
chigh='#f0f0f0' # Hour/minute
cmed='#b8b8b8' # Smallest text (perceptually lower due to smaller text)
clow='#b0b0b0' # Medium size text
# Panel Text
sep="<span size='xx-small' strikethrough='true'> </span>"
spc="<span size='xx-small'> </span>\n"
mw="<span color='$clow' size='small'> $(date +%0d)\n$(date +%a)</span>\n"
mw="<span color='$clow' size='small'>$(date +%0d)\n$(date +%a)</span>\n"
ct="<span color='$cmed' size='xx-small'>$(TZ=US/Central date +%H) CT</span>\n"
utc="<span color='$cmed' size='xx-small'>$(date -u +%H) UT</span>\n"
hm="<span color='$chigh' size='medium'>$(date +%H)\n$(date +%M)</span>"
echo -e "<txt>$sep\n$mw$sep\n$ct$utc$sep\n$hm\n$sep</txt>"
# Tooltip - markup cannot be used here
#
zone() {
local zone="$1"
echo "$(TZ="$zone" date +"%Y-%m-%d %H:%M") $zone"
}
echo -e "<tool>$(zone US/Central)\n$(zone US/Pacific)\n$(zone UTC)\n$(zone Europe/London)\n$(zone Asia/Tokyo)</tool>"