class Tmux::Client

Attributes

current_pane[R]

@return [Pane] The currently displayed {Pane pane}. @tmuxver >=1.2

current_window[R]

@return [Window] The currently displayed {Window window}. @tmuxver >=1.2

device[R]

@return [String]

height[R]

@return [Integer]

identifier[R]

@return [String]

messages[R]

@tmux show-messages @return [Array<String>] A log of messages @tmuxver &gt;=1.2

server[R]

@return [Server]

session[RW]

Setting this will make a client switch to another {Session session}.

@tmux switch-client @return [Session]

term[R]

$TERM of a client.

@return [String]

utf8[R]

True if the terminal is using UTF-8.

@return [Boolean]

utf8?[R]

True if the terminal is using UTF-8.

@return [Boolean]

width[R]

@return [Integer]

Public Class Methods

new(server, device) click to toggle source
# File lib/tmux/client.rb, line 7
def initialize(server, device)
  @server, @device = server, device
end

Public Instance Methods

command_prompt(template, prompts = []) click to toggle source

Opens a command prompt in the client. This may be used to execute commands interactively.

@param [String] template The template is used as the command to

execute. Before the command is executed, the first occurrence
of the string '%%' and all occurrences of '%1' are replaced by
the response to the first prompt, the second '%%' and all '%2'
are replaced with the response to the second prompt, and so on
for further prompts. Up to nine prompt responses may be
replaced ('%1' to '%9')

@param [Array<String>] prompts prompts is a list

of prompts which are displayed in order; otherwise a single
prompt is displayed, constructed from template

@return [void] @tmux command-prompt @todo escape prompts and template

# 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() click to toggle source

Detaches a client from tmux.

@tmux detach-client @return [void]

# File lib/tmux/client.rb, line 70
def detach
  @server.invoke_command "detach-client -t #@device"
end
display_panes() click to toggle source

Displays a visible indicator of each {Pane pane} shown by a client.

@tmux display-panes @return [void] @tmuxver &gt;=1.0

# 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() click to toggle source

Locks a client.

@tmux lock-client @return [void] @tmuxver &gt;=1.1

# 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) click to toggle source

Displays a message.

@param [String] text The message to display @tmux display-message @return [void] @tmuxver &gt;=1.0

# File lib/tmux/client.rb, line 152
def message(text)
  @server.check_for_version!("1.0")

  @server.invoke_command "display-message -t #@device \"#{text}\""
end
refresh() click to toggle source

Refreshs a client.

@tmux refresh-client @return [void]

# File lib/tmux/client.rb, line 97
def refresh
  @server.invoke_command "refresh-client -t #@device"
end
select_interactively() click to toggle source

Opens a prompt inside a client allowing a {Window window} index to be entered interactively.

@tmux command-prompt + select-window @return [void]

# File lib/tmux/client.rb, line 162
def select_interactively
  command_prompt "select-window -t:%%", ["index"]
end
session=(new_session) click to toggle source
# File lib/tmux/client.rb, line 29
def session=(new_session)
  @server.invoke_command "switch-client -c #@device -t #{new_session.number}"
end
suspend() click to toggle source

Suspends a client.

@tmux suspend-client @return [void]

# File lib/tmux/client.rb, line 89
def suspend
  @server.invoke_command "suspend-client -c #@device"
end