Skip to content

Commit 00ddef7

Browse files
author
Brodie Kurczynski
committed
Added formatting for utc_time segment
Can help distinguish UTC from local time more easily.
1 parent 2e867e0 commit 00ddef7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

segments/utc_time.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Prints the current time in UTC.
22

3+
TMUX_POWERLINE_SEG_UTC_TIME_FORMAT_DEFAULT="%H:%M %Z"
4+
5+
generate_segmentrc() {
6+
read -d '' rccontents << EORC
7+
# date(1) format for the UTC time.
8+
export TMUX_POWERLINE_SEG_UTC_TIME_FORMAT="${TMUX_POWERLINE_SEG_UTC_TIME_FORMAT_DEFAULT}"
9+
EORC
10+
echo "$rccontents"
11+
}
12+
13+
__process_settings() {
14+
if [ -z "$TMUX_POWERLINE_SEG_UTC_TIME_FORMAT" ]; then
15+
export TMUX_POWERLINE_SEG_UTC_TIME_FORMAT="${TMUX_POWERLINE_SEG_UTC_TIME_FORMAT_DEFAULT}"
16+
fi
17+
}
18+
319
run_segment() {
4-
date -u +"%H:%M"
20+
__process_settings
21+
date -u +"$TMUX_POWERLINE_SEG_UTC_TIME_FORMAT"
522
return 0
623
}

0 commit comments

Comments
 (0)