Class: Appear::Terminal::MacTerminal

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

Overview

Base class for mac terminal support

Direct Known Subclasses

Iterm2, TerminalApp

Instance Method Summary collapse

Methods inherited from BaseService

delegate, #initialize, require_service, required_services

Constructor Details

This class inherits a constructor from Appear::BaseService

Instance Method Details

#app_nameString

This method is abstract.

subclasses must implement this method.

Returns “app name” on OS X. Both the process name of processes of this app, and the name used by Applescript to send events to this app.

Returns:

  • (String)

    “app name” on OS X. Both the process name of processes of this app, and the name used by Applescript to send events to this app.

Raises:

  • (NotImplemented)


46
47
48
# File 'lib/appear/terminal.rb', line 46

def app_name
  raise NotImplemented
end

#panesArray<#tty>

This method is abstract.

subclasses must implement this method.

Enumerate the panes (seperate interactive sessions) that this terminal program has.

Returns:

  • (Array<#tty>)

    any objects with a tty field

Raises:

  • (NotImplemented)


61
62
63
# File 'lib/appear/terminal.rb', line 61

def panes
  raise NotImplemented
end

#reveal_pane(pane) ⇒ Object

This method is abstract.

subclasses must implement this method.

Reveal a pane. Subclasses must implement this method.

Parameters:

  • pane (#tty)

    any object with a tty field

Raises:

  • (NotImplemented)


69
70
71
# File 'lib/appear/terminal.rb', line 69

def reveal_pane(pane)
  raise NotImplemented
end

#running?Boolean

Returns true if the app has a running process, false otherwise.

Returns:

  • (Boolean)

    true if the app has a running process, false otherwise.



52
53
54
# File 'lib/appear/terminal.rb', line 52

def running?
  services.processes.pgrep(app_name).length > 0
end