Add tmux statusline example

This commit is contained in:
Kim Silkebækken 2012-11-26 16:16:39 +01:00
parent 6a1912aece
commit 07b23f5418
2 changed files with 28 additions and 0 deletions

23
examples/tmux/powerline.py Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''Powerline tmux statusline example.
Run with `tmux -f tmux.conf`.
'''
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from lib.core import Powerline, mksegment
from lib.renderers import TmuxSegmentRenderer
powerline = Powerline([
mksegment('⭤ SSH', 220, 166, attr=Powerline.ATTR_BOLD),
mksegment('username', 153, 31),
mksegment('23:45', 248, 239),
mksegment('10.0.0.110', 231, 239, attr=Powerline.ATTR_BOLD),
mksegment(filler=True, cterm_fg=236, cterm_bg=236),
])
print(powerline.render(TmuxSegmentRenderer()).encode('utf-8'))

5
examples/tmux/tmux.conf Normal file
View File

@ -0,0 +1,5 @@
set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set-option -g status-left-length 100
set-option -g status-left "#(./powerline.py)"