Skip to content

Commit f432159

Browse files
authored
Merge pull request #350 from abrahamnm/main
Alternative timezone support for time segment
2 parents 6f8de03 + 6150f39 commit f432159

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ TN Khanh <[email protected]>
4040
4141
Drew Daniels <[email protected]>
4242
Danfeng Shan <[email protected]>
43+
Abraham Nuñez <[email protected]>

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)