Class: WorkOn::MacTerminal
- Inherits:
-
AbstractTerminal
- Object
- AbstractTerminal
- WorkOn::MacTerminal
- Includes:
- Appscript
- Defined in:
- lib/work_on/terminals/mac_terminal.rb
Overview
Native Mac OS X implementation uses rb-appscript
Defined Under Namespace
Instance Method Summary collapse
-
#initialize ⇒ MacTerminal
constructor
A new instance of MacTerminal.
- #new_window ⇒ Object
- #windows ⇒ Object
Methods inherited from AbstractTerminal
#execute, #selected_tab, #selected_window
Constructor Details
#initialize ⇒ MacTerminal
Returns a new instance of MacTerminal.
10 11 12 13 |
# File 'lib/work_on/terminals/mac_terminal.rb', line 10 def initialize @appscript = app("Terminal.app") @process = app("System Events").application_processes['Terminal'] end |
Instance Method Details
#new_window ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/work_on/terminals/mac_terminal.rb', line 28 def new_window prev = selected_window @process.keystroke('n', :using => :command_down) window = selected_window prev.select! window end |
#windows ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/work_on/terminals/mac_terminal.rb', line 15 def windows @appscript.windows.get.map! do |window| # it seems this returns far too many windows (some of them don't even exist) # so we check a property which will error when something is wrong begin window.selected.get MacWindow.new self, @process, window rescue nil end end.compact! # don't forget to remove the nil values end |