Class: OpenTerms::GnomeTerminal
- Inherits:
-
Object
- Object
- OpenTerms::GnomeTerminal
- Defined in:
- lib/open_terms/gnome_terminal.rb
Instance Attribute Summary collapse
-
#term_pid ⇒ Object
readonly
Returns the value of attribute term_pid.
Instance Method Summary collapse
-
#initialize ⇒ GnomeTerminal
constructor
A new instance of GnomeTerminal.
- #open(commands) ⇒ Object
Constructor Details
#initialize ⇒ GnomeTerminal
Returns a new instance of GnomeTerminal.
4 5 6 |
# File 'lib/open_terms/gnome_terminal.rb', line 4 def initialize @term_pid = `xdotool getactivewindow` end |
Instance Attribute Details
#term_pid ⇒ Object (readonly)
Returns the value of attribute term_pid.
3 4 5 |
# File 'lib/open_terms/gnome_terminal.rb', line 3 def term_pid @term_pid end |
Instance Method Details
#open(commands) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/open_terms/gnome_terminal.rb', line 8 def open commands commands.each do |tab_name, command| run "xdotool windowfocus #{term_pid}" run "xdotool key ctrl+shift+t" run "xdotool key ctrl+shift+alt+t" run "xdotool type #{tab_name}" run "xdotool key Return" command.split(" ").each do |command_part| run "xdotool type #{command_part}" run "xdotool key space" end run "xdotool key Return" end end |