Trait vte4::prelude::TerminalExtManual
source · pub trait TerminalExtManual: 'static {
// Required methods
fn check_regex_simple_at(
&self,
x: f64,
y: f64,
regexes: &[&Regex],
match_flags: u32,
) -> Vec<GString>;
fn set_colors(
&self,
foreground: Option<&RGBA>,
background: Option<&RGBA>,
palette: &[&RGBA],
);
fn watch_child(&self, child_pid: Pid);
fn spawn_async<P: FnOnce(Result<Pid, Error>) + 'static, Q: Fn() + 'static>(
&self,
pty_flags: PtyFlags,
working_directory: Option<&str>,
argv: &[&str],
envv: &[&str],
spawn_flags: SpawnFlags,
child_setup: Q,
timeout: i32,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
fn spawn_future<Q: Fn() + 'static>(
&self,
pty_flags: PtyFlags,
working_directory: Option<&str>,
argv: &[&str],
envv: &[&str],
spawn_flags: SpawnFlags,
child_setup: Q,
timeout: i32,
) -> Pin<Box_<dyn Future<Output = Result<Pid, Error>> + 'static>>;
unsafe fn spawn_with_fds_async<P: FnOnce(Result<Pid, Error>) + 'static, Q: Fn() + 'static>(
&self,
pty_flags: PtyFlags,
working_directory: Option<&str>,
argv: &[&str],
envv: &[&str],
fds: Vec<OwnedFd>,
map_fds: &[RawFd],
spawn_flags: SpawnFlags,
child_setup: Q,
timeout: i32,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
);
unsafe fn spawn_with_fds_future<Q: Fn() + 'static>(
&self,
pty_flags: PtyFlags,
working_directory: Option<&str>,
argv: &[&str],
envv: &[&str],
fds: Vec<OwnedFd>,
map_fds: &[RawFd],
spawn_flags: SpawnFlags,
child_setup: Q,
timeout: i32,
) -> Pin<Box_<dyn Future<Output = Result<Pid, Error>> + 'static>>;
}
Required Methods§
sourcefn check_regex_simple_at(
&self,
x: f64,
y: f64,
regexes: &[&Regex],
match_flags: u32,
) -> Vec<GString>
Available on crate feature v0_70
only.
fn check_regex_simple_at( &self, x: f64, y: f64, regexes: &[&Regex], match_flags: u32, ) -> Vec<GString>
v0_70
only.Checks each regex in @regexes if the text in and around the position (x, y)
matches the regular expressions. If a match exists, the matched
text is stored in @matches at the position of the regex in @regexes; otherwise
None
is stored there. Each non-None
element of @matches should be freed with
g_free().
Note that the regexes in @regexes should have been created using the PCRE2_MULTILINE
flag.
§regexes
an array of #VteRegex
§match_flags
PCRE2 match flags, or 0
§Returns
true
iff any of the regexes produced a match
§matches
a location to store the matches
sourcefn set_colors(
&self,
foreground: Option<&RGBA>,
background: Option<&RGBA>,
palette: &[&RGBA],
)
fn set_colors( &self, foreground: Option<&RGBA>, background: Option<&RGBA>, palette: &[&RGBA], )
@palette specifies the new values for the 256 palette colors: 8 standard colors, their 8 bright counterparts, 6x6x6 color cube, and 24 grayscale colors. Omitted entries will default to a hardcoded value.
@palette_size must be 0, 8, 16, 232 or 256.
If @foreground is None
and @palette_size is greater than 0, the new foreground
color is taken from @palette[7]. If @background is None
and @palette_size is
greater than 0, the new background color is taken from @palette[0].
§foreground
the new foreground color, or None
§background
the new background color, or None
§palette
the color palette
sourcefn watch_child(&self, child_pid: Pid)
fn watch_child(&self, child_pid: Pid)
Watches @child_pid. When the process exists, the #VteTerminal::child-exited signal will be called with the child’s exit status.
Prior to calling this function, a #VtePty must have been set in @self
using vte_terminal_set_pty().
When the child exits, the terminal’s #VtePty will be set to None
.
Note: g_child_watch_add() or g_child_watch_add_full() must not have been called for @child_pid, nor a #GSource for it been created with g_child_watch_source_new().
Note: when using the g_spawn_async() family of functions,
the [glib::SpawnFlags::DO_NOT_REAP_CHILD
][crate::glib::SpawnFlags::DO_NOT_REAP_CHILD] flag MUST have been passed.
§child_pid
a #GPid
sourcefn spawn_async<P: FnOnce(Result<Pid, Error>) + 'static, Q: Fn() + 'static>(
&self,
pty_flags: PtyFlags,
working_directory: Option<&str>,
argv: &[&str],
envv: &[&str],
spawn_flags: SpawnFlags,
child_setup: Q,
timeout: i32,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn spawn_async<P: FnOnce(Result<Pid, Error>) + 'static, Q: Fn() + 'static>( &self, pty_flags: PtyFlags, working_directory: Option<&str>, argv: &[&str], envv: &[&str], spawn_flags: SpawnFlags, child_setup: Q, timeout: i32, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
A convenience function that wraps creating the #VtePty and spawning the child process on it. Like vte_terminal_spawn_with_fds_async(), except that this function does not allow passing file descriptors to the child process. See vte_terminal_spawn_with_fds_async() for more information.
§pty_flags
flags from #VtePtyFlags
§working_directory
the name of a directory the command should start
in, or None
to use the current working directory
§argv
child’s argument vector
§envv
a list of environment
variables to be added to the environment before starting the process, or None
§spawn_flags
flags from #GSpawnFlags
§child_setup
an extra child setup function to run in the child just before exec(), or None
§child_setup_data
user data for @child_setup, or None
§child_setup_data_destroy
a #GDestroyNotify for @child_setup_data, or None
§timeout
a timeout value in ms, -1 for the default timeout, or G_MAXINT to wait indefinitely
§cancellable
a #GCancellable, or None
§callback
a #VteTerminalSpawnAsyncCallback, or None
fn spawn_future<Q: Fn() + 'static>( &self, pty_flags: PtyFlags, working_directory: Option<&str>, argv: &[&str], envv: &[&str], spawn_flags: SpawnFlags, child_setup: Q, timeout: i32, ) -> Pin<Box_<dyn Future<Output = Result<Pid, Error>> + 'static>>
sourceunsafe fn spawn_with_fds_async<P: FnOnce(Result<Pid, Error>) + 'static, Q: Fn() + 'static>(
&self,
pty_flags: PtyFlags,
working_directory: Option<&str>,
argv: &[&str],
envv: &[&str],
fds: Vec<OwnedFd>,
map_fds: &[RawFd],
spawn_flags: SpawnFlags,
child_setup: Q,
timeout: i32,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
unsafe fn spawn_with_fds_async<P: FnOnce(Result<Pid, Error>) + 'static, Q: Fn() + 'static>( &self, pty_flags: PtyFlags, working_directory: Option<&str>, argv: &[&str], envv: &[&str], fds: Vec<OwnedFd>, map_fds: &[RawFd], spawn_flags: SpawnFlags, child_setup: Q, timeout: i32, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
A convenience function that wraps creating the #VtePty and spawning the child process on it. See vte_pty_new_sync(), vte_pty_spawn_with_fds_async(), and vte_pty_spawn_finish() for more information.
When the operation is finished successfully, @callback will be called
with the child #GPid, and a None
#GError. The child PID will already be
watched via vte_terminal_watch_child().
When the operation fails, @callback will be called with a -1 #GPid,
and a non-None
#GError containing the error information.
Note that [glib::SpawnFlags::STDOUT_TO_DEV_NULL
][crate::glib::SpawnFlags::STDOUT_TO_DEV_NULL], [glib::SpawnFlags::STDERR_TO_DEV_NULL
][crate::glib::SpawnFlags::STDERR_TO_DEV_NULL],
and [glib::SpawnFlags::CHILD_INHERITS_STDIN
][crate::glib::SpawnFlags::CHILD_INHERITS_STDIN] are not supported in @spawn_flags, since
stdin, stdout and stderr of the child process will always be connected to
the PTY.
If @fds is not None
, the child process will map the file descriptors from
@fds according to @map_fds; @n_map_fds must be less or equal to @n_fds.
This function will take ownership of the file descriptors in @fds;
you must not use or close them after this call.
Note that all open file descriptors apart from those mapped as above will be closed in the child. (If you want to keep some other file descriptor open for use in the child process, you need to use a child setup function that unsets the FD_CLOEXEC flag on that file descriptor manually.)
Beginning with 0.60, and on linux only, and unless VTE_SPAWN_NO_SYSTEMD_SCOPE
is
passed in @spawn_flags, the newly created child process will be moved to its own
systemd user scope; and if VTE_SPAWN_REQUIRE_SYSTEMD_SCOPE
is passed, and creation
of the systemd user scope fails, the whole spawn will fail.
You can override the options used for the systemd user scope by
providing a systemd override file for ‘vte-spawn-.scope’ unit. See man:systemd.unit(5)
for further information.
Note that if @self has been destroyed before the operation is called,
@callback will be called with a None
@self; you must not do anything
in the callback besides freeing any resources associated with @user_data,
but taking care not to access the now-destroyed #VteTerminal. Note that
in this case, if spawning was successful, the child process will be aborted
automatically.
Beginning with 0.52, sets PWD to @working_directory in order to preserve symlink components. The caller should also make sure that symlinks were preserved while constructing the value of @working_directory, e.g. by using vte_terminal_get_current_directory_uri(), g_get_current_dir() or get_current_dir_name().
§pty_flags
flags from #VtePtyFlags
§working_directory
the name of a directory the command should start
in, or None
to use the current working directory
§argv
child’s argument vector
§envv
a list of environment
variables to be added to the environment before starting the process, or None
§fds
an array of file descriptors, or None
§map_fds
an array of integers, or None
§spawn_flags
flags from #GSpawnFlags
§child_setup
an extra child setup function to run in the child just before exec(), or None
§child_setup_data
user data for @child_setup, or None
§child_setup_data_destroy
a #GDestroyNotify for @child_setup_data, or None
§timeout
a timeout value in ms, -1 for the default timeout, or G_MAXINT to wait indefinitely
§cancellable
a #GCancellable, or None
§callback
a #VteTerminalSpawnAsyncCallback, or None