aboutsummaryrefslogtreecommitdiff
path: root/segments/time.sh
blob: e307399ecfeef4e7b259159d023cf7738fb05228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Prints the current time.

TMUX_POWERLINE_SEG_TIME_FORMAT_DEFAULT="%H:%M"

generate_segmentrc() {
	read -d '' rccontents  << EORC
# date(1) format for the time. Americans might want to have "%I:%M %p".
export TMUX_POWERLINE_SEG_TIME_FORMAT="${TMUX_POWERLINE_SEG_TIME_FORMAT_DEFAULT}"
EORC
	echo "$rccontents"
}

__process_settings() {
	if [ -z "$TMUX_POWERLINE_SEG_TIME_FORMAT" ]; then
		export TMUX_POWERLINE_SEG_TIME_FORMAT="${TMUX_POWERLINE_SEG_TIME_FORMAT_DEFAULT}"
	fi
}

run_segment() {
        __process_settings
	date +"$TMUX_POWERLINE_SEG_TIME_FORMAT"
	return 0
}