Class: WorkOn::MacTerminal::MacWindow

Inherits:
Window
  • Object
show all
Defined in:
lib/work_on/terminals/mac_terminal.rb

Instance Method Summary collapse

Constructor Details

#initialize(terminal, process, appscript) ⇒ MacWindow

Returns a new instance of MacWindow.



52
53
54
55
56
# File 'lib/work_on/terminals/mac_terminal.rb', line 52

def initialize(terminal, process, appscript)
  @terminal = terminal
  @process = process
  @appscript = appscript
end

Instance Method Details

#new_tabObject



76
77
78
79
80
81
82
# File 'lib/work_on/terminals/mac_terminal.rb', line 76

def new_tab
  prev = @terminal.selected_window
  self.select!
  @process.keystroke('t', :using => :command_down)
  prev.select!
  self.tabs.last
end

#select!Object

Selects this window

NOTE: This is not publicly exported since it is only used on the mac Where i need to send keystrokes to the process, so i need to be able to control the currently selected window



68
69
70
# File 'lib/work_on/terminals/mac_terminal.rb', line 68

def select!
  @appscript.frontmost.set(true)
end

#selected?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/work_on/terminals/mac_terminal.rb', line 58

def selected?
  @appscript.frontmost.get
end

#tabsObject



72
73
74
# File 'lib/work_on/terminals/mac_terminal.rb', line 72

def tabs
  @appscript.tabs.get.map {|tab| MacTab.new @terminal, tab }
end

#to_sObject



84
85
86
# File 'lib/work_on/terminals/mac_terminal.rb', line 84

def to_s
  @appscript.id_.get
end