Class: Terminitor::TerminatorCore

Inherits:
AbstractCore show all
Defined in:
lib/terminitor/cores/terminator_core.rb

Overview

Terminator core for Terminitor.

Since Terminator doesn’t have a complete IPC interface, everything is done by using “xdotool” to simulate keypresses.

Instance Attribute Summary

Attributes inherited from AbstractCore

#termfile, #terminal, #windows, #working_dir

Instance Method Summary collapse

Methods inherited from AbstractCore

#active_window, #load_termfile, #process!, #run_in_window, #set_delayed_options, #setup!

Constructor Details

#initialize(path) ⇒ TerminatorCore

Returns a new instance of TerminatorCore.



8
9
10
11
# File 'lib/terminitor/cores/terminator_core.rb', line 8

def initialize(path)
  abort("xdotool required for Terminator support") if (@xdotool = `which xdotool`.chomp).empty?
  super
end

Instance Method Details

#execute_command(cmd, options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/terminitor/cores/terminator_core.rb', line 13

def execute_command(cmd, options = {})
  # add a cr to the end if missing
  cmd += "\n" if (cmd =~ /\n\Z/).nil?
  run_in_active_terminator cmd, options
  true
end

#open_tab(options = nil) ⇒ Object



20
21
22
# File 'lib/terminitor/cores/terminator_core.rb', line 20

def open_tab(options = nil)
  send_keypress "ctrl+shift+t", options
end

#open_window(options = nil) ⇒ Object



24
25
26
# File 'lib/terminitor/cores/terminator_core.rb', line 24

def open_window(options = nil)
  send_keypress "ctrl+shift+i", options
end