RunicGuestStartInfo record

Namespace Runic.Application.Views.Desktop in Runic.Application.Views.Desktop 0.23.0

public sealed record RunicGuestStartInfo : IEquatable<RunicGuestStartInfo>

Inherits or implements IEquatable.

How a host starts a guest application (the Runic host protocol, runic-host/1).

Parameters

FileName

The guest's executable: an absolute path, a path relative to the current directory, or a name to look up in PATH. It is started directly, never through a shell.

Arguments

Its arguments, passed as they are, such as the hidden command hosted through which the guest reaches its hosted mode. They are visible to other processes: never pass a secret.

Remarks

The guest inherits this process's environment with RunicGuestStartInfo.Environment applied, and without RUNIC_APPLICATION_SERVE_ONLY and RUNIC_APPLICATION_CLOSE_AFTER_OPEN. Its standard input and output are the host's, for the protocol; its other output and its standard error go to this application's log at the Debug level (category Runic.Application.Views.Desktop.Hosting). Experimental; see docs/experimental.md.

Constructors

RunicGuestStartInfo

public RunicGuestStartInfo(string FileName, IReadOnlyList<string> Arguments)

How a host starts a guest application (the Runic host protocol, runic-host/1).

Parameters

FileName

The guest's executable: an absolute path, a path relative to the current directory, or a name to look up in PATH. It is started directly, never through a shell.

Arguments

Its arguments, passed as they are, such as the hidden command hosted through which the guest reaches its hosted mode. They are visible to other processes: never pass a secret.

Remarks

The guest inherits this process's environment with RunicGuestStartInfo.Environment applied, and without RUNIC_APPLICATION_SERVE_ONLY and RUNIC_APPLICATION_CLOSE_AFTER_OPEN. Its standard input and output are the host's, for the protocol; its other output and its standard error go to this application's log at the Debug level (category Runic.Application.Views.Desktop.Hosting). Experimental; see docs/experimental.md.

Properties

AllowElevatedGuest

public bool AllowElevatedGuest { get; init; }

Whether this host, which runs elevated, allows the guest to run elevated too; false by default, when a guest that runs elevated refuses hosted mode (guest-elevated).

Remarks

A guest started by an elevated process inherits its elevation: an elevated token on Windows, root on Linux and macOS. With true, the offer tells the guest that this host allows it, and a guest that also sets RunicGuestOptions.AllowElevatedHost is hosted after it checked for itself that its parent, this process, runs elevated as the same user. Every other combination is refused as without it.

Only a host that runs elevated may set it: an unelevated one fails the start with host-not-elevated before the guest starts. RunicGuestStartInfo.FileName, and RunicGuestStartInfo.WorkingDirectory when it is set, must be fully qualified paths, so that the elevated guest is never looked up in PATH or the current directory. The guest runs with administrator rights: start only an executable in a location that only administrators can change, such as Program Files or a directory owned by root, never one the user can write to. The residual risks are in docs/security.md, "Hosted application windows".

Arguments

public IReadOnlyList<string> Arguments { get; init; }

The guest's arguments.

Environment

public IReadOnlyDictionary<string, string?>? Environment { get; init; }

Environment variables to set for the guest, and those with a null value to remove; the others are inherited. Never pass a secret: other processes of the user can read a process's environment.

FileName

public string FileName { get; init; }

The guest's executable.

UserStarted

public bool UserStarted { get; init; }

Whether the user started the guest directly, such as from the host's own menu or launcher; false by default.

Remarks

By default the guest's windows start guest-activated (RunicHostedServiceRequest.IsGuestActivated): the guest opened them, so the host refuses their clipboard reads, clipboard writes and launches until the user switches to the window, clicks its native menu bar, picks a context menu item or drops files onto it. A link the user clicks in a guest's fresh first window is refused until then.

With true, the first activation of the guest's first window counts as the user's, as if the user had switched to it. Set it only when the user's own action started the guest just now. The trade-off: the guest decides when it opens that window, so it can open it later, while the user works in another window, and the host still treats it as the user's. Later windows, and the first one once the guest presents, shows, maximizes or makes it full screen, are guest-activated as usual.

WorkingDirectory

public string? WorkingDirectory { get; init; }

The guest's working directory, or null, the default, for this process's current one.