Vte::Terminal
Object Hierarchy
- Object
- GLib::Instantiatable
- GLib::Object
- Gtk::Object
- Gtk::Widget
- Vte::Terminal
- Gtk::Widget
- Gtk::Object
- GLib::Object
- GLib::Instantiatable
Class Methods
Vte::Terminal.new
-
Create a new terminal widget.
- Returns: a new Vte::Terminal object
Instance Methods
fork_command(comand=nil, argv=nil, envv=nil, directory=nil, lastlog=true, utmp=true, wtmp=ture)
-
Starts the specified command under a newly-allocated
controlling pseudo-terminal. The
argv
[0] is expected to be the name of the file being run, as it would be if execve() were being called. TERM is automatically set to reflect the terminal widget's emulation setting. Iflastlog
,utmp
orwtmp
are true, logs the session to the specified system log files.- command: the name of a binary to run. forks user shell if nil.
- argv: the argument array to be passed to command
- envv: an array of environment variables to be added to the environment before starting command
- directory: the name of a directory the command should start in
- lastlog: true if the session should be logged to the lastlog
- utmp: true if the session should be logged to the utmp/utmpx log
- wtmp: true if the session should be logged to the wtmp/wtmpx log
- Returns: the ID of the new process
fork_pty(envv=nil, directory=nil, lastlog=true, utmp=true, wtmp=true)
-
Starts a new child process under a newly-allocated
controlling pseudo-terminal. TERM is automatically set
to reflect the terminal widget's emulation setting. If
lastlog
,utmp
orwtmp
are true, logs the session to the specified system log files.- envv: an array of environment variables to be added to the environment before starting command
- directory: the name of a directory the command should start in
- lastlog: true if the session should be logged to the lastlog
- utmp: true if the session should be logged to the utmp/utmpx log
- wtmp: true if the session should be logged to the wtmp/wtmpx log
- Returns: the ID of the new process in the parent, 0 in the child, and -1 if there was an error
feed(data)
-
Interprets
data
as if it were data received from a child process. This can either be used to drive the terminal without a child process, or just to mess with your users.- data: a string in the terminal's current encoding
- Returns: nil
feed_child(text)
-
Sends a block of UTF-8 text to the child as if it were
entered by the user at the keyboard.
- text: data to send to the child
- Returns: nil
feed_child_binary(data)
-
Sends a block of binary data to the child.
- data: data to send to the child
- Returns: nil
copy_clipboard
-
Places the selected text in the terminal in the
Gdk::Selection::CLIPBOARD selection.
- Returns: nil
paste_clipboard
-
Sends the contents of the Gdk::Selection::CLIPBOARD selection to the
terminal's child. If necessary, the data is converted from UTF-8 to the
terminal's current encoding. It's called on paste menu item, or when
user presses Shift+Insert.
- Returns: nil
copy_primary
-
Places the selected text in the terminal in the
Gdk::Selection::PRIMARY selection.
- Returns: nil
paste_primary
-
Sends the contents of the Gdk::Selection::PRIMARY
selection to the terminal's child. If necessary, the
data is converted from UTF-8 to the terminal's current
encoding. The terminal will call also paste the
Gdk::Selection::PRIMARY selection when the user clicks
with the the second mouse button.
- Returns: nil
set_size(columns, rows)
-
Attempts to change the terminal's size in terms of rows
and columns. If the attempt succeeds, the widget will
resize itself to the proper size.
- columns: the desired number of columns
- rows: the desired number of rows
- Returns: nil
audible_bell?
-
Checks whether or not the terminal will beep when the
child outputs the "bl" sequence.
- Returns: true if audible bell is enabled, false if not
set_audible_bell(is_audible)
-
Controls whether or not the terminal will beep when the
child outputs the "bl" sequence.
- is_audible: true if the terminal should beep
- Returns: nil
audible_bell=(is_audiable)
- Same as #set_audible_bell but returns self.
visible_bell?
-
Checks whether or not the terminal will present a
visible bell to the user when the child outputs the "bl"
sequence. The terminal will clear itself to the default
foreground color and then repaint itself.
- returns: true if visible bell is enabled, false if not
set_visible_bell(is_visible)
-
Controls whether or not the terminal will present a
visible bell to the user when the child outputs the "bl"
sequence. The terminal will clear itself to the default
foreground color and then repaint itself.
- is_visible: true if the terminal should flash
- Returns: nil
visible_bell=(is_visible)
- Same as #set_visible_bell but returns self.
set_scroll_background(scroll)
-
Controls whether or not the terminal will scroll the
background image (if one is set) when the text in the
window must be scrolled.
- scroll: true if the terminal should scroll the background image along with text.
- Returns: nil
scroll_background=(scroll)
- Same as #set_scroll_background but returns self.
set_scroll_on_output(scroll)
-
Controls whether or not the terminal will forcibly
scroll to the bottom of the viewable history when the
new data is received from the child.
- scroll: true if the terminal should scroll on output
- Returns: nil
scroll_on_output=(scroll)
- Same as #set_scroll_on_output but returns self.
set_scroll_on_keystroke(scroll)
-
Controls whether or not the terminal will forcibly scroll to the bottom of
the viewable history when the user presses a key. Modifier keys do not
trigger this behavior.
- scroll: true if the terminal should scroll on keystrokes
- Returns: nil
scroll_on_keystroke=(scroll)
- Same as #set_scroll_on_keystroke but returns self.
set_color_dim(dim)
-
Sets the color used to draw dim text in the default foreground color.
- dim: the new dim color (Gdk::Color)
- Returns: nil
color_dim=(dim)
- Same as #set_color_dim but returns self.
set_color_bold(bold)
-
Sets the color used to draw bold text in the default foreground color.
- bold: the new bold color (Gdk::Color)
- Returns: self
color_bold=(bold)
- Same as #set_color_bold but returns self.
set_color_foreground(foreground)
-
Sets the foreground color used to draw normal text
- foreground: the new foreground color (Gdk::Color)
- Returns: nil
color_foreground=(foreground)
- Same as #set_color_foreground but returns self.
set_color_background(background)
-
Sets the background color for text which does not have
a specific background color assigned. Only has effect
when no background image is set and when the terminal
is not transparent.
- background: the new background color
- Returns: self
color_background=(background)
- Same as #set_color_background but returns self.
set_color_cursor(cursor_background)
-
Sets the background color for text which is under the
cursor. If nil, text under the cursor will be drawn
with foreground and background colors reversed.
- cursor_background: the new color to use for the text cursor (Gdk::Color or nil)
- Returns: self
color_cursor=(cursor_background)
- Same as #set_color_cursor but returns self.
set_color_highlight(highlight_background)
-
Sets the background color for text which is highlighted.
If nil, highlighted text (which is usually highlighted
because it is selected) will be drawn with foreground
and background colors reversed.
- highlight_background: the new color to use for highlighted text (Gdk::Color or nil)
- Returns: self
color_highlight=(highlight_background)
- Same as #set_color_highlight but returns self.
set_colors(foreground, background, palette)
-
The terminal widget uses a 28-color model comprised of the default foreground and background colors, the bold foreground color, the dim foreground color, an eight color palette, bold versions of the eight color palette, and a dim version of the the eight color palette.
palette
size must be either 0, 8, 16, or 24. Ifforeground
is nil andpalette
size is greater than 0, the new foreground color is taken frompalette
[7]. Ifbackground
is nil andpalette
size is greater than 0, the new background color is taken frompalette
[0]. Ifpalette
size is 8 or 16, the third (dim) and possibly the second (bold) 8-color palettes are extrapolated from the new background color and the items inpalette
.- foreground: the new foreground color (Gdk::Color), or nil
- background: the new background color (Gdk::Color), or nil
- palette: the color palette (an Array of Gdk::Color)
- Returns: self
set_default_colors
-
Reset the terminal palette to reasonable compiled-in defaults.
- Returns: nil
set_background_image(image)
-
Sets a background image for the widget. Text which
would otherwise be drawn using the default background
color will instead be drawn over the specified image.
If necessary, the image will be tiled to cover the
widget's entire visible area. If specified by
Vte::Terminal#set_background_saturation, the terminal
will tint its in-memory copy of the image before
applying it to the terminal.
- image: a Gdk::Pixbuf to use, or nil to cancel
- Returns: nil
set_background_image(path)
-
Sets a background image for the widget. If specified by
Vte::Terminal#set_background_saturation, the terminal
will tint its in-memory copy of the image before
applying it to the terminal.
- path: path to an image file
- Returns: nil
background_image=(image)
background_image=(path)
- Same as #set_background_image but returns self.
set_background_tint_color(color)
-
If a background image has been set using
Vte::Terminal#set_background_image,
Vte::Terminal#set_background_image_file, or
Vte::Terminal#set_background_transparent, and the value
set by Vte::Terminal#set_background_saturation is less
than one, the terminal will adjust the color of the
image before drawing the image. To do so, the terminal
will create a copy of the background image (or snapshot
of the root window) and modify its pixel values. The
initial tint color is black.
- color: a color (Gdk::Color) which the terminal background should be tinted to if its saturation is not 1.0.
- Returns: nil
background_tint_color=(color)
- Same as #set_background_tint_color but returns self.
set_background_saturation(saturation)
-
If a background image has been set using
Vte::Terminal#set_background_image(),
Vte::Terminal#set_background_image_file(), or
Vte::Terminal#set_background_transparent(), and the
saturation value is less than 1.0, the terminal will
adjust the colors of the image before drawing the image.
To do so, the terminal will create a copy of the
background image (or snapshot of the root window) and
modify its pixel values.
- saturation: a floating point value between 0.0 and 1.0.
- Returns: nil
background_saturation=(saturation)
- Same as #set_background_saturation but returns self.
set_background_transparent(transparent)
-
Sets the terminal's background image to the pixmap
stored in the root window, adjusted so that if there are
no windows below your application, the widget will
appear to be transparent.
- transparent: true if the terminal should fake transparency
- Returns: self
background_transparent=(transparent)
- Same as #set_background_transparent but returns self.
set_cursor_blinks(blink)
-
Sets whether or not the cursor will blink. The length
of the blinking cycle is controlled by the
"gtk-cursor-blink-time" GTK+ setting.
- blink: true if the cursor should blink
- Returns: nil
cursor_blinks=(blink)
- Same as #set_cursor_blinks but returns self.
set_scrollback_lines(lines)
-
Sets the length of the scrollback buffer used by the
terminal. The size of the scrollback buffer will be set
to the larger of this value and the number of visible
rows the widget can display, so 0 can safely be used to
disable scrollback. Note that this setting only affects
the normal screen buffer. For terminal types which have
an alternate screen buffer, no scrollback is allowed on
the alternate screen buffer.
- lines: the length of the history buffer
- Returns: self
scrollback_lines=(lines)
- Same as #set_scrollback_lines but returns self.
im_append_menuitems(menushell)
-
Appends menu items for various input methods to the
given menu. The user can select one of these items to
modify the input method used by the terminal.
- menushell: a Gtk::MenuShell
- Returns: self
set_font(font_desc, antialias=Vte::TerminalAntiAlias::USE_DEFAULT)
-
Sets the font used for rendering all text displayed by
the terminal, overriding any fonts set using
Gtk::Widget#modify_font. The terminal will immediately
attempt to load the desired font, retrieve its metrics,
and attempt to resize itself to keep the same number of
rows and columns.
- font_desc: The Pango::FontDescription of the desired font.
- antialias: Specify if anti aliasing of the fonts is to be used or not. (Vte::TerminalAntiAlias)
- Returns: nil
set_font(name, antialias=Vte::TerminalAntiAlias::USE_DEFAULT)
-
A convenience function which converts
name
into a Pango::FontDescription and passes it to Vte::Terminal#set_font_full.- name: A string describing the font.
- antialias: Whether or not to antialias the font (if possible). (Vte::TerminalAntiAlias)
- Returns: nil
font
-
Queries the terminal for information about the fonts which will be
used to draw text in the terminal.
- Returns: a Pango::FontDescription describing the font the terminal is currently using to render text.
using_xft?
-
A Vte::Terminal can use multiple methods to draw text.
This function allows an application to determine whether
or not the current method uses fontconfig to find fonts.
This setting cannot be changed by the caller, but in
practice usually matches the behavior of GTK+ itself.
- Returns: true if the terminal is using fontconfig to find fonts, false if the terminal is using PangoX.
allow_bold?
-
Checks whether or not the terminal will attempt to draw bold text by
repainting text with a one-pixel offset.
- returns: true if bolding is enabled, false if not
set_allow_bold(allow_bold)
-
Controls whether or not the terminal will attempt to
draw bold text by repainting text with a different
offset.
- allow_bold: true if the terminal should attempt to draw bold text
- Returns: self
allow_bold=(allow_bold)
- Same as #set_allow_bold but returns self.
has_selection?
-
Checks if the terminal currently contains selected text.
Note that this is different from determining if the
terminal is the owner of any Gtk::Clipboard? items.
- Returns: true if part of the text in the terminal is selected.
have_selection?
- Same as #has_selection?.
set_word_chars(spec)
-
When the user double-clicks to start selection, the terminal will extend the selection on word boundaries. It will treat characters included in
spec
as parts of words, and all other characters as word separators. Ranges of characters can be specified by separating them with a hyphen.As a special case, if
spec
is nil or the empty string, the terminal will treat all graphic non-punctuation non-space characters as word characters.- spec: a specification string, or nil
- Returns: nil
word_chars=(spec)
- Same as #set_word_chars but returns nil.
word_char?(c)
-
Checks if a particular character is considered to be
part of a word or not, based on the values last passed
to Vte::Terminal#set_word_chars.
- c: a candidate Unicode code point
- Returns: true if the character is considered to be part of a word
set_backspace_binding(binding)
-
Modifies the terminal's backspace key binding, which
controls what string or control sequence the terminal
sends to its child when the user presses the backspace
key.
- binding: a Vte::TerminalEraseBinding for the backspace key
- Returns: nil
backspace_binding=(binding)
- Same as #set_backspace_binding but returns self.
set_delete_binding(binding)
-
Modifies the terminal's delete key binding, which
controls what string or control sequence the terminal
sends to its child when the user presses the delete key.
- binding: a Vte::TerminalEraseBinding for the delete key
- Returns: self
delete_binding=(binding)
- Same as #set_delete_binding but returns self.
set_mouse_autohide(setting)
-
Changes the value of the terminal's mouse autohide
setting. When autohiding is enabled, the mouse cursor
will be hidden when the user presses a key and shown
when the user moves the mouse. This setting can be read
using Vte::Terminal#get_mouse_autohide.
- setting: true if the autohide should be enabled
- Returns: self
mouse_autohide=(setting)
- Same as #set_delete_binding but returns self.
mouse_autohide?
-
Determines the value of the terminal's mouse autohide
setting. When autohiding is enabled, the mouse cursor
will be hidden when the user presses a key and shown
when the user moves the mouse. This setting can be
changed using Vte::Terminal#set_mouse_autohide.
- Returns: true if autohiding is enabled, false if not.
reset(full, clear_history)
-
Resets as much of the terminal's internal state as
possible, discarding any unprocessed input data,
resetting character attributes, cursor state, national
character set state, status line, terminal modes
(insert/delete), selection state, and encoding.
- full: true to reset tabstops
- clear_history: true to empty the terminal's scrollback buffer
- Returns: nil
get_text(get_attrs=nil, include_trailing_spaces=false, &is_selected)
-
Extracts a view of the visible part of the terminal. If
is_selected
is not nil, characters will only be read ifis_selected
returns true after being passed the column and row, respectively. A Vte::CharAttributes structure is added to return values for each byte added to the returned string detailing the character's position, colors, and other characteristics.- get_attrs: whether returning attributes or not.
- include_trailing_spaces: whether including spaces at the end of lines.
- is_selected(column, row): Proc returns true if the position specified by a column and a row is selected, false if not.
- Returns: an array of text and attributes (an array of Vte::CharAttributes) if get_attrs != false, only text if get_attrs == false.
get_text_range(start_row, start_col, end_row, end_col, get_attrs=nil, &is_selected)
-
Extracts a view of the visible part of the terminal. If
is_selected
is not nil, characters will only be read ifis_selected
returns true after being passed the column and row, respectively. A Vte::CharAttributes structure is added to return value for each byte added to the returned string detailing the character's position, colors, and other characteristics. The entire scrollback buffer is scanned, so it is possible to read the entire contents of the buffer using this function.- start_row: first row to search for data
- start_col: first column to search for data
- end_row: last row to search for data
- end_col: last column to search for data
- get_attrs: whether returning attributes or not.
- is_selected(column, row): Proc returns true if the position specified by a column and a row is selected, false if not.
- Returns: an array of text and attributes (an array of Vte::CharAttributes) if get_attrs != false, only text if get_attrs == false.
cursor_position(column, row)
-
Reads the location of the insertion cursor and returns
it. The row coordinate is absolute.
- column: long which will hold the column
- row: long which will hold the row
- Returns: self
match_clear_all
-
Clears the list of regular expressions the terminal
uses to highlight text when the user moves the mouse
cursor.
- Returns: nil
match_add(match)
-
Adds a regular expression to the list of matching expressions. When the
user moves the mouse cursor over a section of displayed text which matches
this expression, the text will be highlighted.
- match: a regular expression as string
- Returns: an integer associated with this expression
match_set_cursor(tag, cursor)
-
Sets which cursor the terminal will use if the pointer
is over the pattern specified by
tag
. The terminal keeps a reference tocursor
.- tag: the tag of the regex which should use the specified cursor (Integer)
- cursor: the Gdk::Cursor which the terminal should use when the pattern is highlighted
- Returns: nil
match_set_cursor_type(tag, cursor)
-
Sets which cursor the terminal will use if the pointer
is over the pattern specified by
tag
. A convenience wrapper for Vte::Terminal#match_set_cursor.- tag: the tag of the regex which should use the specified cursor (Integer)
- cursor_type: a Gdk::CursorType?
- Returns: nil
match_remove(tag)
-
Removes the regular expression which is associated with
the given
tag
from the list of expressions which the terminal will highlight when the user moves the mouse cursor over matching text.- tag: the tag of the regex to remove
- Returns: nil
match_check(column, row)
-
Checks if the text in and around the specified position matches any of the regular expressions previously set using Vte::Terminal#match_add. If a match exists, the text string is returned and if
tag
is not nil, the number associated with the matched regular expression will be stored intag
.If more than one regular expression has been set with Vte::Terminal#match_add, then expressions are checked in the order in which they were added.
- column: the text column
- row: the text row
- Returns: an array of a string which matches one of the previously set regular expressions and tag of the regular expression.
set_emulation(emulation)
-
Sets what type of terminal the widget attempts to
emulate by scanning for control sequences defined in the
system's termcap file. Unless you are interested in
this feature, always use "xterm".
- emulation: the name of a terminal description
- Returns: nil
emulation=(emulation)
- Same as #set_emulation but returns self.
emulation
-
Queries the terminal for its current emulation, as last
set by a call to Vte::Terminal#set_emulation().
- Returns: the name of the terminal type the widget is attempting to emulate
default_emulation
-
Queries the terminal for its default emulation, which is attempted if the
terminal type passed to vte_terminal_set_emulation() is NULL.
- Returns: the name of the default terminal type the widget attempts to emulate
set_encoding(codeset)
-
Changes the encoding the terminal will expect data from
the child to be encoded with. For certain terminal
types, applications executing in the terminal can change
the encoding. The default encoding is defined by the
application's locale settings.
- codeset: a valid GLib.convert target
- Returns: nil
encoding=(codeset)
- Same as #set_encoding but returns self.
encoding
-
Determines the name of the encoding in which the
terminal expects data to be encoded.
- Returns: the current encoding for the terminal.
status_line
-
Some terminal emulations specify a status line which is
separate from the main display area, and define a means
for applications to move the cursor to the status line
and back.
- Returns: the current contents of the terminal's status line. For terminals like "xterm", this will usually be the empty string. The string must not be modified or freed by the caller.
padding
-
Determines the amount of additional space the widget is
using to pad the edges of its visible area. This is
necessary for cases where characters in the selected
font don't themselves include a padding area and the
text itself would otherwise be contiguous with the
window border. Applications which use the widget's
#row_count, #column_count, #char_height, and #char_width
fields to set geometry hints using
Gtk::Window#set_geometry_hints will need to add this
value to the base size. The returned values are the
total padding used in each direction, and do not need to
be doubled.
- Returns: an array of address in which to store left/right-edge padding and address in which to store top/bottom-edge ypadding.
set_pty(pty_master)
-
Attach an existing PTY master side to the terminal widget. Use
instead of Vte::Terminal#fork_command or Vte::Terminal#fork_pty.
- pty_master: a file descriptor of the master end of a PAY
- Returns: nil
pty=
- Same as #set_pty but returns self.
adjustment
-
- Returns: the contents of terminal's adjustment field (Gtk::Adjustment)
char_width
-
- Returns: the contents of terminal's char_width field (Integer)
char_height
-
- Returns: the contents of terminal's char_height field (Integer)
char_ascent
-
- Returns: the contents of terminal's char_ascent field (Integer)
char_descent
-
- Returns: the contents of terminal's char_descent field (Integer)
row_count
-
- Returns: the contents of terminal's row_count field (Integer)
column_count
-
- Returns: the contents of terminal's column_count field (Integer)
window_title
-
- Returns: the contents of terminal's title field (String)
icon_title
-
- Returns: the contents of terminal's icon_title field (String)
Signals
char-size-changed: self
-
- self:
child-exited: self
-
- self:
commit: self
-
- self:
contents-changed: self
-
- self:
cursor-moved: self
-
- self:
decrease-font-size: self
-
- self:
deiconify-window: self
-
- self:
emulation-changed: self
-
- self:
encoding-changed: self
-
- self:
eof: self
-
- self:
icon-title-changed: self
-
- self:
iconify-window: self
-
- self:
increase-font-size: self
-
- self:
lower-window: self
-
- self:
maximize-window: self
-
- self:
move-window: self
-
- self:
raise-window: self
-
- self:
refresh-window: self
-
- self:
resize-window: self
-
- self:
restore-window: self
-
- self:
selection-changed: self
-
- self:
status-line-changed: self
-
- self:
text-deleted: self
-
- self:
text-inserted: self
-
- self:
text-modified: self
-
- self:
text-scrolled: self
-
- self:
window-title-changed: self
-
- self:
Parola chiave:
Referenze: