Class: TopinambourTerminal

Inherits:
Vte::Terminal
  • Object
show all
Defined in:
lib/terminal.rb

Overview

The default vte terminal customized

Instance Attribute Summary collapse

Instance Method Summary collapse

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 |widget|
    tabterm = widget.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 |widget|
    tabterm = widget.parent
    notebook = tabterm.parent
    when_terminal_title_change if notebook && notebook.current.term == self
  end

  add_popup_menu
  configure
end

Instance Attribute Details

#custom_titleObject

Returns the value of attribute custom_title.



36
37
38
# File 'lib/terminal.rb', line 36

def custom_title
  @custom_title
end

#last_matchObject (readonly)

Returns the value of attribute last_match.



35
36
37
# File 'lib/terminal.rb', line 35

def last_match
  @last_match
end

Returns the value of attribute menu.



35
36
37
# File 'lib/terminal.rb', line 35

def menu
  @menu
end

#pidObject (readonly)

Returns the value of attribute pid.



35
36
37
# File 'lib/terminal.rb', line 35

def pid
  @pid
end

#previewObject

Returns the value of attribute preview.



36
37
38
# File 'lib/terminal.rb', line 36

def preview
  @preview
end

#regexesObject (readonly)

Returns the value of attribute regexes.



35
36
37
# File 'lib/terminal.rb', line 35

def regexes
  @regexes
end

Instance Method Details

#applicationObject



100
101
102
103
# File 'lib/terminal.rb', line 100

def application
  @application = self.parent.toplevel.application unless @application
  @application
end

#colorsObject



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

#fontObject



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_settingsObject



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_dirObject



64
65
66
# File 'lib/terminal.rb', line 64

def pid_dir
  File.readlink("/proc/#{@pid}/cwd")
end

#terminal_titleObject



68
69
70
# File 'lib/terminal.rb', line 68

def terminal_title
  @custom_title.class == String ? @custom_title : window_title.to_s
end