Class: Tmux::Window::Status::State

Inherits:
Object
  • Object
show all
Defined in:
lib/tmux/window/status/state.rb

Overview

Each status can be in different states: normal, current and alert

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window, state) ⇒ State

Returns a new instance of State



6
7
8
9
# File 'lib/tmux/window/status/state.rb', line 6

def initialize(window, state)
  @window = window
  @state  = state
end

Instance Attribute Details

#attributesSymbol

Returns:

  • (Symbol)


49
50
51
# File 'lib/tmux/window/status/state.rb', line 49

def attributes
  get_option "attr"
end

#background_colorSymbol

Returns:

  • (Symbol)


14
15
16
# File 'lib/tmux/window/status/state.rb', line 14

def background_color
  get_option "bg"
end

#foreground_colorSymbol

Returns:

  • (Symbol)


25
26
27
# File 'lib/tmux/window/status/state.rb', line 25

def foreground_color
  get_option "fg"
end

#formatString

The format in which the window is displayed in the status line window list.

Returns:

  • (String)


38
39
40
# File 'lib/tmux/window/status/state.rb', line 38

def format
  get_option "format"
end

Instance Method Details

#get_option(option) ⇒ Undefined (private)



58
59
60
# File 'lib/tmux/window/status/state.rb', line 58

def get_option(option)
  @window.options.get option_name(option)
end

#option_name(option) ⇒ Undefined (private)



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/tmux/window/status/state.rb', line 68

def option_name(option)
  state = case @state
          when :normal
            ""
          when :current
            "current-"
          when :alert
            "alert-"
          end
  "window-status-#{state}#{option}"
end

#set_option(option, value) ⇒ Undefined (private)



63
64
65
# File 'lib/tmux/window/status/state.rb', line 63

def set_option(option, value)
  @window.options.set option_name(option), value
end