Class: Appear::Tmux::Session
- Inherits:
-
TmuxValue
- Object
- Util::ValueClass
- TmuxValue
- Appear::Tmux::Session
- Defined in:
- lib/appear/tmux.rb
Overview
A tmux session. Has many windows.
Instance Method Summary collapse
-
#attached ⇒ Fixnum
Number of clients attached to this session.
-
#clients ⇒ Array<Client>
All clients attached to this session.
-
#height ⇒ Fixnum
Height, in text rows.
-
#id ⇒ String
Tmux id of this session.
-
#new_window(opts = {}) ⇒ Object
Create a new window in this session.
-
#session ⇒ String
Session name.
-
#target ⇒ String
String suitable for use as the “target” specifier for a Tmux command.
-
#width ⇒ Fixnum
Width, in text columns.
-
#windows ⇒ Array<Window>
The windows in this session.
Methods inherited from TmuxValue
format_string, parse, property, #tmux
Methods inherited from Util::ValueClass
#initialize, properties, property
Constructor Details
This class inherits a constructor from Appear::Util::ValueClass
Instance Method Details
#attached ⇒ Fixnum
Returns number of clients attached to this session.
133 |
# File 'lib/appear/tmux.rb', line 133 property :attached, :tmux => :session_attached, :parse => :to_i |
#clients ⇒ Array<Client>
Returns all clients attached to this session.
155 156 157 |
# File 'lib/appear/tmux.rb', line 155 def clients tmux.clients.select { |c| c.session == session } end |
#height ⇒ Fixnum
Returns height, in text rows.
139 |
# File 'lib/appear/tmux.rb', line 139 property :height, :tmux => :session_height, :parse => :to_i |
#id ⇒ String
Returns tmux id of this session.
130 |
# File 'lib/appear/tmux.rb', line 130 property :id, :tmux => :session_id |
#new_window(opts = {}) ⇒ Object
Create a new window in this session. By default, the window will be created at the end of the session.
163 164 165 166 |
# File 'lib/appear/tmux.rb', line 163 def new_window(opts = {}) win = windows.last.window || -1 tmux.new_window(opts.merge(:t => "#{target}:#{win + 1}")) end |
#session ⇒ String
Returns session name.
127 |
# File 'lib/appear/tmux.rb', line 127 property :session, tmux: :session_name |
#target ⇒ String
String suitable for use as the “target” specifier for a Tmux command
144 145 146 147 |
# File 'lib/appear/tmux.rb', line 144 def target # session id end |
#width ⇒ Fixnum
Returns width, in text columns.
136 |
# File 'lib/appear/tmux.rb', line 136 property :width, :tmux => :session_width, :parse => :to_i |
#windows ⇒ Array<Window>
Returns the windows in this session.
150 151 152 |
# File 'lib/appear/tmux.rb', line 150 def windows tmux.windows.select { |w| w.session == session } end |