diff --git a/README.md b/README.md index 6d89adea..3c289064 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,10 @@ The options for the `battery` segment are: - `always_show_percentage`: If true, show percentage when fully charged on AC. - `low_threshold`: Threshold percentage for low-battery indicator color. +The options for the `time` segment are: + +- `format`: Format string as used by strftime function, e.g. `%H:%M`. + ### Contributing new types of segments The `powerline_shell/segments` directory contains python scripts which are diff --git a/powerline_shell/segments/time.py b/powerline_shell/segments/time.py index deafd49f..686b1dd8 100644 --- a/powerline_shell/segments/time.py +++ b/powerline_shell/segments/time.py @@ -6,7 +6,10 @@ class Segment(BasicSegment): def add_to_powerline(self): powerline = self.powerline - if powerline.args.shell == 'bash': + format = powerline.segment_conf('time', 'format') + if format: + time_ = ' %s ' % time.strftime(format) + elif powerline.args.shell == 'bash': time_ = ' \\t ' elif powerline.args.shell == 'zsh': time_ = ' %* '