aboutsummaryrefslogtreecommitdiff
path: root/segments/time.sh
diff options
context:
space:
mode:
authorCody Hiar <chiar@hybridforge.com>2015-08-12 12:06:23 -0600
committerCody Hiar <chiar@hybridforge.com>2015-08-12 12:06:23 -0600
commit07fc2644a237187dd4c5680e88f4adadbf533603 (patch)
treebb6335e180df48c5a6f0b893312857d36ad470f7 /segments/time.sh
Initial commit of the working files
Diffstat (limited to 'segments/time.sh')
-rwxr-xr-xsegments/time.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/segments/time.sh b/segments/time.sh
new file mode 100755
index 0000000..e307399
--- /dev/null
+++ b/segments/time.sh
@@ -0,0 +1,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
+}