Class: Tmux::StatusBar

Inherits:
Object
  • Object
show all
Defined in:
lib/tmux/status_bar.rb,
lib/tmux/status_bar/field.rb

Overview

Every session has a status bar. This is where various information as well as a list of windows will be displayed. For this purpose, the status bar is divided into three parts: the left, center and right part. While the center part displays the window list, the left and right part can be set to display any text.

This class allows accessing various attributes (e.g. the background color of the bar) and the editable parts (left and right).

Note: You will not have to instantiate this class. Use Tmux::Session#status_bar instead.

Defined Under Namespace

Classes: Field

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (StatusBar) initialize(session)

Returns a new instance of StatusBar

Parameters:



32
33
34
35
36
# File 'lib/tmux/status_bar.rb', line 32

def initialize(session)
  @session = session
  @left    = Field.new(self,  :left)
  @right   = Field.new(self, :right)
end

Instance Attribute Details

- (Symbol) background_color

Returns:

  • (Symbol)


55
56
57
# File 'lib/tmux/status_bar.rb', line 55

def background_color
  @session.options.status_bg
end

- (Symbol) foreground_color

Returns:

  • (Symbol)


66
67
68
# File 'lib/tmux/status_bar.rb', line 66

def foreground_color
  @session.options.status_fg
end

- (Number) interval

Returns The interval in which the status bar will be updated.

Returns:

  • (Number)

    The interval in which the status bar will be updated.



78
79
80
# File 'lib/tmux/status_bar.rb', line 78

def interval
  @session.options.status_interval
end

- (Symbol<:left, :right, :centre>) justification

The justification of the window list component of the status line.

Returns:

  • (Symbol<:left, :right, :centre>)


92
93
94
# File 'lib/tmux/status_bar.rb', line 92

def justification
  @session.options.status_justify
end

- (Symbol<:emacs, :vi>) keymap

Returns:

  • (Symbol<:emacs, :vi>)


103
104
105
106
# File 'lib/tmux/status_bar.rb', line 103

def keymap
  # TODO keymap class?
  @session.options.status_keys
end

- (Field) left (readonly)

The left field which may display custom text and widgets.

Returns:



24
25
26
# File 'lib/tmux/status_bar.rb', line 24

def left
  @left
end

- (Field) right (readonly)

The right field which may display custom text and widgets.

Returns:



30
31
32
# File 'lib/tmux/status_bar.rb', line 30

def right
  @right
end

- (Session) session (readonly)

Returns:



19
20
21
# File 'lib/tmux/status_bar.rb', line 19

def session
  @session
end

- (Boolean) utf8 Also known as: utf8?

Instruct tmux to treat top-bit-set characters in Tmux::StatusBar::Field#text as UTF-8. Notably, this is important for wide characters. This option defaults to false.

Returns:

  • (Boolean)


119
120
121
# File 'lib/tmux/status_bar.rb', line 119

def utf8
  @session.options.status_utf8
end

Instance Method Details

- hide

This method returns an undefined value.

Hides the status bar.



41
42
43
# File 'lib/tmux/status_bar.rb', line 41

def hide
  @session.options.status = false
end

- show

This method returns an undefined value.

Shows the status bar.



48
49
50
# File 'lib/tmux/status_bar.rb', line 48

def show
  @session.options.status = true
end