Class: Appear::Terminal::Iterm2

Inherits:
MacTerminal show all
Defined in:
lib/appear/terminal.rb

Overview

Iterm2 support service.

Instance Method Summary collapse

Methods inherited from MacTerminal

#running?

Methods inherited from BaseService

delegate, #initialize, require_service, required_services

Constructor Details

This class inherits a constructor from Appear::BaseService

Instance Method Details

#app_nameObject



99
100
101
# File 'lib/appear/terminal.rb', line 99

def app_name
  'iTerm2'
end

#new_window(command_str) ⇒ #tty

Create a new window running the given command.

Parameters:

  • command_str (String)

    command to run

Returns:

  • (#tty)

    pane



121
122
123
124
# File 'lib/appear/terminal.rb', line 121

def new_window(command_str)
  res = services.mac_os.call_method('iterm2_new_window', command_str)
  OpenStruct.new(res)
end

#panesObject

See Also:



104
105
106
107
108
109
110
# File 'lib/appear/terminal.rb', line 104

def panes
  pids = services.processes.pgrep(app_name)
  services.mac_os.call_method('iterm2_panes').map do |hash|
    hash[:pids] = pids
    OpenStruct.new(hash)
  end
end

#reveal_pane(pane) ⇒ Object



113
114
115
# File 'lib/appear/terminal.rb', line 113

def reveal_pane(pane)
  services.mac_os.call_method('iterm2_reveal_tty', pane.tty)
end