DesktopOpenRegistration record

Namespace Runic.Platform in Runic.Platform 0.23.0

public sealed record DesktopOpenRegistration : IEquatable<DesktopOpenRegistration>

Inherits or implements IEquatable.

The URL schemes and file types an application registers with the desktop, for the current user.

Parameters

DisplayName

The application's name, which the desktop shows, such as in its list of applications for a type.

Exceptions

ArgumentException

The display name is empty or contains a control character.

Remarks

A registration makes the application a handler that the desktop offers; it never makes it the default, which stays the user's choice (IDesktopApplications.SetDefaultApplicationAsync). The desktop then starts the application with the file or URL as one argument, which DesktopOpenRequests.FromLaunch reads.

Constructors

DesktopOpenRegistration

public DesktopOpenRegistration(string DisplayName)

The URL schemes and file types an application registers with the desktop, for the current user.

Parameters

DisplayName

The application's name, which the desktop shows, such as in its list of applications for a type.

Exceptions

ArgumentException

The display name is empty or contains a control character.

Remarks

A registration makes the application a handler that the desktop offers; it never makes it the default, which stays the user's choice (IDesktopApplications.SetDefaultApplicationAsync). The desktop then starts the application with the file or URL as one argument, which DesktopOpenRequests.FromLaunch reads.

Properties

DisplayName

public string DisplayName { get; init; }

The application's name, which the desktop shows.

Executable

public string? Executable { get; init; }

The fully qualified path of the executable the desktop starts; null by default, for Environment.ProcessPath. The desktop passes the file or URL as one quoted argument ("%1" on Windows, %U on Linux). macOS registers the running bundle and ignores it.

Exceptions

ArgumentException

The path is not fully qualified, or contains a quote or a control character.

FileTypes

public ImmutableArray<DesktopFileType> FileTypes { get; init; }

File types; empty by default.

Exceptions

ArgumentException

A value is null, or an extension appears twice.

UrlSchemes

public ImmutableArray<string> UrlSchemes { get; init; }

URL schemes, such as org.example.notes, by the rules of DesktopOpenOptions.UrlSchemes; empty by default.

Exceptions

ArgumentException

A value is not a URL scheme, is file, http or https, or appears twice.