diff --git a/config.py.dist b/config.py.dist index bad4143d..a24c592a 100644 --- a/config.py.dist +++ b/config.py.dist @@ -10,6 +10,9 @@ SEGMENTS = [ # Show current virtual environment (see http://www.virtualenv.org/) 'virtual_env', +# Show current time + 'time', + # Show the current user's username as in ordinary prompts 'username', diff --git a/segments/time.py b/segments/time.py new file mode 100644 index 00000000..68431504 --- /dev/null +++ b/segments/time.py @@ -0,0 +1,12 @@ +def add_time_segment(): + if powerline.args.shell == 'bash': + time = ' \\t ' + elif powerline.args.shell == 'zsh': + time = ' %* ' + else: + import time + time = ' %s ' % time.strftime('%H:%M:%S') + + powerline.append(time, Color.HOSTNAME_FG, Color.HOSTNAME_BG) + +add_time_segment()