Class: Tmux::Client
- Inherits:
-
Object
- Object
- Tmux::Client
- Defined in:
- lib/tmux/client.rb
Instance Attribute Summary collapse
-
#current_pane ⇒ Pane
readonly
The currently displayed pane.
-
#current_window ⇒ Window
readonly
The currently displayed window.
- #device ⇒ String readonly
- #height ⇒ Integer readonly
- #identifier ⇒ String readonly
-
#messages ⇒ Array<String>
readonly
A log of messages.
- #server ⇒ Server readonly
-
#session ⇒ Session
Setting this will make a client switch to another session.
-
#term ⇒ String
readonly
$TERM of a client.
-
#utf8 ⇒ Boolean
(also: #utf8?)
readonly
True if the terminal is using UTF-8.
- #width ⇒ Integer readonly
Instance Method Summary collapse
-
#command_prompt(template, prompts = [])
Opens a command prompt in the client.
-
#detach
Detaches a client from tmux.
-
#display_panes
Displays a visible indicator of each pane shown by a client.
-
#initialize(server, device) ⇒ Client
constructor
A new instance of Client.
-
#lock
Locks a client.
-
#message(text)
Displays a message.
-
#refresh
Refreshs a client.
-
#select_interactively
Opens a prompt inside a client allowing a window index to be entered interactively.
-
#suspend
Suspends a client.
Constructor Details
#initialize(server, device) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/tmux/client.rb', line 7 def initialize(server, device) @server, @device = server, device end |
Instance Attribute Details
#current_pane ⇒ Pane (readonly)
Returns The currently displayed pane.
136 137 138 |
# File 'lib/tmux/client.rb', line 136 def current_pane @current_pane end |
#current_window ⇒ Window (readonly)
Returns The currently displayed window.
125 126 127 |
# File 'lib/tmux/client.rb', line 125 def current_window @current_window end |
#device ⇒ String (readonly)
6 7 8 |
# File 'lib/tmux/client.rb', line 6 def device @device end |
#height ⇒ Integer (readonly)
41 42 43 |
# File 'lib/tmux/client.rb', line 41 def height @height end |
#identifier ⇒ String (readonly)
12 13 14 |
# File 'lib/tmux/client.rb', line 12 def identifier @identifier end |
#messages ⇒ Array<String> (readonly)
Returns A log of messages.
104 105 106 |
# File 'lib/tmux/client.rb', line 104 def @messages end |
#session ⇒ Session
Setting this will make a client switch to another session.
22 23 24 |
# File 'lib/tmux/client.rb', line 22 def session @session end |
#term ⇒ String (readonly)
$TERM of a client.
50 51 52 |
# File 'lib/tmux/client.rb', line 50 def term @term end |
#utf8 ⇒ Boolean (readonly) Also known as: utf8?
True if the terminal is using UTF-8.
59 60 61 |
# File 'lib/tmux/client.rb', line 59 def utf8 @utf8 end |
#width ⇒ Integer (readonly)
34 35 36 |
# File 'lib/tmux/client.rb', line 34 def width @width end |
Instance Method Details
#command_prompt(template, prompts = [])
escape prompts and template
This method returns an undefined value.
Opens a command prompt in the client. This may be used to execute commands interactively.
184 185 186 187 188 189 190 191 |
# File 'lib/tmux/client.rb', line 184 def command_prompt(template, prompts = []) prompts = prompts.join(",") flags = [] flags << "-p #{prompts}" unless prompts.empty? flags << "-t #{identifier}" flags << "\"#{template}\"" @server.invoke_command "command-prompt #{flags.join(" ")}" end |
#detach
This method returns an undefined value.
Detaches a client from tmux.
70 71 72 |
# File 'lib/tmux/client.rb', line 70 def detach @server.invoke_command "detach-client -t #@device" end |
#display_panes
This method returns an undefined value.
Displays a visible indicator of each pane shown by a client.
117 118 119 120 121 |
# File 'lib/tmux/client.rb', line 117 def display_panes @server.check_for_version!("1.0") @server.invoke_command("display-panes -t #@device") end |
#lock
This method returns an undefined value.
Locks a client.
79 80 81 82 83 |
# File 'lib/tmux/client.rb', line 79 def lock @server.check_for_version!("1.1") @server.invoke_command "lock-client -t #@device" end |
#message(text)
This method returns an undefined value.
Displays a message.
152 153 154 155 156 |
# File 'lib/tmux/client.rb', line 152 def (text) @server.check_for_version!("1.0") @server.invoke_command "display-message -t #@device \"#{text}\"" end |
#refresh
This method returns an undefined value.
Refreshs a client.
97 98 99 |
# File 'lib/tmux/client.rb', line 97 def refresh @server.invoke_command "refresh-client -t #@device" end |
#select_interactively
This method returns an undefined value.
Opens a prompt inside a client allowing a window index to be entered interactively.
162 163 164 |
# File 'lib/tmux/client.rb', line 162 def select_interactively command_prompt "select-window -t:%%", ["index"] end |
#suspend
This method returns an undefined value.
Suspends a client.
89 90 91 |
# File 'lib/tmux/client.rb', line 89 def suspend @server.invoke_command "suspend-client -c #@device" end |