Class: TopinambourTerminal
- Inherits:
-
Vte::Terminal
- Object
- Vte::Terminal
- TopinambourTerminal
- Defined in:
- lib/terminal.rb
Overview
The default vte terminal customized
Instance Attribute Summary collapse
-
#custom_title ⇒ Object
Returns the value of attribute custom_title.
-
#last_match ⇒ Object
readonly
Returns the value of attribute last_match.
-
#menu ⇒ Object
readonly
Returns the value of attribute menu.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#preview ⇒ Object
Returns the value of attribute preview.
-
#regexes ⇒ Object
readonly
Returns the value of attribute regexes.
Instance Method Summary collapse
- #application ⇒ Object
- #colors ⇒ Object
- #colors=(colors) ⇒ Object
- #font ⇒ Object
- #font=(font_str) ⇒ Object
-
#initialize(command_string, working_dir = nil) ⇒ TopinambourTerminal
constructor
Create a new TopinambourTerminal instance that runs command_string.
- #load_settings ⇒ Object
- #pid_dir ⇒ Object
- #terminal_title ⇒ Object
Constructor Details
#initialize(command_string, working_dir = nil) ⇒ TopinambourTerminal
Create a new TopinambourTerminal instance that runs command_string
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/terminal.rb', line 40 def initialize(command_string, working_dir = nil) super() command_array = parse_command(command_string) rescued_spawn(command_array, working_dir) signal_connect "child-exited" do || tabterm = .parent notebook = tabterm.parent current_page = notebook.page_num(tabterm) notebook.remove_page(current_page) @application.quit unless notebook.n_pages >= 1 end signal_connect "window-title-changed" do || tabterm = .parent notebook = tabterm.parent when_terminal_title_change if notebook && notebook.current.term == self end configure end |
Instance Attribute Details
#custom_title ⇒ Object
Returns the value of attribute custom_title.
36 37 38 |
# File 'lib/terminal.rb', line 36 def custom_title @custom_title end |
#last_match ⇒ Object (readonly)
Returns the value of attribute last_match.
35 36 37 |
# File 'lib/terminal.rb', line 35 def last_match @last_match end |
#menu ⇒ Object (readonly)
Returns the value of attribute menu.
35 36 37 |
# File 'lib/terminal.rb', line 35 def @menu end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
35 36 37 |
# File 'lib/terminal.rb', line 35 def pid @pid end |
#preview ⇒ Object
Returns the value of attribute preview.
36 37 38 |
# File 'lib/terminal.rb', line 36 def preview @preview end |
#regexes ⇒ Object (readonly)
Returns the value of attribute regexes.
35 36 37 |
# File 'lib/terminal.rb', line 35 def regexes @regexes end |
Instance Method Details
#application ⇒ Object
100 101 102 103 |
# File 'lib/terminal.rb', line 100 def application @application = self.parent.toplevel.application unless @application @application end |
#colors ⇒ Object
78 79 80 81 82 |
# File 'lib/terminal.rb', line 78 def colors colors_strings = application.settings["colorscheme"] @colors = colors_strings.map { |c| Gdk::RGBA.parse(c) } @colors end |
#colors=(colors) ⇒ Object
89 90 91 |
# File 'lib/terminal.rb', line 89 def colors=(colors) set_colors(colors[0], colors[1], colors[2..-1]) end |
#font ⇒ Object
84 85 86 87 |
# File 'lib/terminal.rb', line 84 def font font_str = application.settings["font"] @font = Pango::FontDescription.new(font_str) end |
#font=(font_str) ⇒ Object
93 94 95 96 97 98 |
# File 'lib/terminal.rb', line 93 def font=(font_str) application.settings["font"] = font_str font = Pango::FontDescription.new(font_str) set_font(font) @font = font end |
#load_settings ⇒ Object
72 73 74 75 76 |
# File 'lib/terminal.rb', line 72 def load_settings colors set_colors(@colors[0], @colors[1], @colors[2..-1]) set_font(font) end |
#pid_dir ⇒ Object
64 65 66 |
# File 'lib/terminal.rb', line 64 def pid_dir File.readlink("/proc/#{@pid}/cwd") end |
#terminal_title ⇒ Object
68 69 70 |
# File 'lib/terminal.rb', line 68 def terminal_title @custom_title.class == String ? @custom_title : window_title.to_s end |