Class ExternalClientLauncher

Class Documentation

class ExternalClientLauncher

This class provides methods to launch external clients from the compositor.

This class launches clients with the correct environment variables (e.g. WAYLAND_DISPLAY) as well as a valid activation token.

See also

miral::InternalClientLauncher - for launching clients in the same process as the compositor

Public Functions

ExternalClientLauncher()

Construct a new external client launcher.

~ExternalClientLauncher()
void operator()(mir::Server &server)
pid_t launch(std::vector<std::string> const &command_line) const

Launch the provided command with an environment configured for Wayland.

If X11 is enabled, then DISPLAY will also be set accordingly.

Parameters:

command_line – the command to launch

Returns:

The pid of the process that was launched.

Pre:

the server has started with this instance passed to #MirRunner::run_with().

pid_t launch_using_x11(std::vector<std::string> const &command_line) const

If X11 is enabled, then launch with an environment configured for X11.

This is useful in occasions where it is desired to coerce applications into using X11

If X11 is unavailable, this method always returns -1.

Returns:

The pid of the process that was launched, or -1 if X11 is not enabled

Pre:

the server has started with this instance passed to #MirRunner::run_with().

void snapcraft_launch(std::string const &desktop_file) const

Use the proposed desktop-entry snap interface to launch a snap.

Parameters:

desktop_file – the desktop file name of the snap

Pre:

the server has started with this instance passed to #MirRunner::run_with().

pid_t launch(std::string const &command) const

Launch the command with an environment configured for Wayland.

If X11 is enabled, then DISPLAY will also be set accordingly.

Parameters:

command – the command to run

Returns:

The pid of the process that was launched.

Pre:

the server has started with this instance passed to #MirRunner::run_with().

Public Static Functions

static std::vector<std::string> split_command(std::string const &command)

Split out the tokens of an escaped command.

Parameters:

command – an unsplit command

Returns:

a command split into a std::vector