Class: TopinambourTerminal
- Inherits:
-
Vte::Terminal
- Object
- Vte::Terminal
- TopinambourTerminal
- Defined in:
- lib/terminal.rb
Overview
The default vte terminal customized
Constant Summary collapse
- REGEXES =
[:REGEX_URL_AS_IS, :REGEX_URL_FILE, :REGEX_URL_HTTP, :REGEX_URL_VOIP, :REGEX_EMAIL, :REGEX_NEWS_MAN, :CSS_COLORS]
Instance Attribute Summary collapse
-
#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.
Instance Method Summary collapse
- #colors=(colors) ⇒ Object
- #font=(font_str) ⇒ Object
-
#initialize(command_string, toplevel, working_dir = nil) ⇒ TopinambourTerminal
constructor
Create a new TopinambourTerminal instance that runs command_string.
- #load_colors ⇒ Object
- #load_font ⇒ Object
-
#load_settings ⇒ Object
Methods used to load Gio::Settings #.
- #load_size_settings ⇒ Object
- #pid_dir ⇒ Object
- #size ⇒ Object
- #terminal_title ⇒ Object
Constructor Details
#initialize(command_string, toplevel, working_dir = nil) ⇒ TopinambourTerminal
Create a new TopinambourTerminal instance that runs command_string
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/terminal.rb', line 43 def initialize(command_string, toplevel, working_dir = nil) super() @toplevel = toplevel @settings = toplevel.application.settings set_name('topinambour-terminal') command_array = parse_command(command_string) rescued_spawn(command_array, working_dir) signal_connect('child-exited') {@toplevel.quit_gracefully} load_settings add_matches handle_mouse_clic end |
Instance Attribute Details
#last_match ⇒ Object (readonly)
Returns the value of attribute last_match.
37 38 39 |
# File 'lib/terminal.rb', line 37 def last_match @last_match end |
#menu ⇒ Object (readonly)
Returns the value of attribute menu.
37 38 39 |
# File 'lib/terminal.rb', line 37 def @menu end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
37 38 39 |
# File 'lib/terminal.rb', line 37 def pid @pid end |
Instance Method Details
#colors=(colors) ⇒ Object
103 104 105 |
# File 'lib/terminal.rb', line 103 def colors=(colors) set_colors(colors[0], colors[1], colors[2..-1]) end |
#font=(font_str) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/terminal.rb', line 107 def font=(font_str) @settings['font'] = font_str font = Pango::FontDescription.new(font_str) set_font(font) @font = font end |
#load_colors ⇒ Object
92 93 94 95 96 |
# File 'lib/terminal.rb', line 92 def load_colors colors_strings = @settings['colorscheme'] @colors = colors_strings.map { |c| Gdk::RGBA.parse(c) } @colors end |
#load_font ⇒ Object
98 99 100 101 |
# File 'lib/terminal.rb', line 98 def load_font font_str = @settings['font'] @font = Pango::FontDescription.new(font_str) end |
#load_settings ⇒ Object
Methods used to load Gio::Settings #
79 80 81 82 83 84 |
# File 'lib/terminal.rb', line 79 def load_settings load_colors set_colors(@colors[0], @colors[1], @colors[2..-1]) set_font(load_font) set_size(*load_size_settings) end |
#load_size_settings ⇒ Object
86 87 88 89 90 |
# File 'lib/terminal.rb', line 86 def load_size_settings h = @settings['height'] w = @settings['width'] [w, h] end |
#pid_dir ⇒ Object
59 60 61 |
# File 'lib/terminal.rb', line 59 def pid_dir File.readlink("/proc/#{@pid}/cwd") end |
#size ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/terminal.rb', line 67 def size col = column_count char_w = char_width row = row_count char_h = char_height [col * char_w, row * char_h] end |
#terminal_title ⇒ Object
63 64 65 |
# File 'lib/terminal.rb', line 63 def terminal_title @custom_title.class == String ? @custom_title : window_title.to_s end |