Skip to content

Commit d36a834

Browse files
committed
Add timezone suppor for time segment
1 parent 6f8de03 commit d36a834

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

segments/time.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ generate_segmentrc() {
66
read -d '' rccontents << EORC
77
# date(1) format for the time. Americans might want to have "%I:%M %p".
88
export TMUX_POWERLINE_SEG_TIME_FORMAT="${TMUX_POWERLINE_SEG_TIME_FORMAT_DEFAULT}"
9+
# Change this to display a different timezone than the system default.
10+
# Use TZ Identifier like "America/Los_Angeles"
11+
export TMUX_POWERLINE_SEG_TIME_TZ=""
912
EORC
1013
echo "$rccontents"
1114
}
@@ -18,6 +21,10 @@ __process_settings() {
1821

1922
run_segment() {
2023
__process_settings
21-
date +"$TMUX_POWERLINE_SEG_TIME_FORMAT"
24+
if [ -n "$TMUX_POWERLINE_SEG_TIME_TZ" ]; then
25+
TZ="$TMUX_POWERLINE_SEG_TIME_TZ" date +"$TMUX_POWERLINE_SEG_TIME_FORMAT"
26+
else
27+
date +"$TMUX_POWERLINE_SEG_TIME_FORMAT"
28+
fi
2229
return 0
2330
}

0 commit comments

Comments
 (0)