Class: Skylab::Myterm::ItermProxy
- Inherits:
-
Object
- Object
- Skylab::Myterm::ItermProxy
- Defined in:
- lib/myterm/api.rb
Defined Under Namespace
Classes: SessionProxy
Constant Summary collapse
- MIN_LEN =
ItermProxy is a wrapper around everything Iterm to the extent that its AppleScript interface supports
50
Instance Method Summary collapse
Instance Method Details
#bounds ⇒ Object
127 128 129 |
# File 'lib/myterm/api.rb', line 127 def bounds app.windows[0].bounds.get end |
#bounds=(arr) ⇒ Object
121 122 123 124 125 |
# File 'lib/myterm/api.rb', line 121 def bounds= arr x = arr.detect { |i| i.to_s !~ /^\d+$/ } and return invalid("expecting digit had #{x.inspect}") x = arr[2,2].detect { |i| i.to_i < MIN_LEN } and return invalid("too small: #{x} (min: #{MIN_LEN})") app.windows[0].bounds.set arr end |
#session ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/myterm/api.rb', line 131 def session @session ||= begin tty = `tty`.strip t = s = 0 catch(:break) do (1..app.terminals.count).each do |i| (1..app.terminals[i].sessions.count).each do |j| if tty == app.terminals[i].sessions[j].tty.get throw(:break, SessionProxy.new(app, i, j)) end end end nil end or fail("couldn't ascertain current session!") end end |