Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorConfig::HostDescriptor Struct Reference

One host of a settings API, as the static descriptor its package installs in <datadir>/phosphor-works/<api>-hosts/ describes it: More...

#include <PhosphorConfig/HostDirectory.h>

Public Member Functions

QString resolvedConfigPath () const
 configPath with its leading variable expanded for this user.

Static Public Member Functions

static std::optional< HostDescriptor > parse (const QJsonObject &json, QString *error)
 Parse json.

Public Attributes

QString id
 Matches [a-z0-9][a-z0-9-]*.
QString name
 A product name, shown untranslated where a user chooses between hosts.
QString busName
 The bus name the host owns while it runs.
QString backend
 The PhosphorConfig backend the file uses. Only json is known.
QString configPath
 The file: $XDG_CONFIG_HOME, $XDG_DATA_HOME, $XDG_STATE_HOME or $HOME, then / and a path with no empty, .
QStringList desktops
 XDG_CURRENT_DESKTOP entries the host serves, compared ignoring case.

Detailed Description

One host of a settings API, as the static descriptor its package installs in <datadir>/phosphor-works/<api>-hosts/ describes it:

{ "Id": "plasmazones", "Name": "PlasmaZones", "BusName": "org.phosphor_works.Placement",
  "Backend": "json", "ConfigPath": "$XDG_CONFIG_HOME/plasmazones/config.json",
  "Desktops": ["KDE"] }

Several hosts can serve one API, each keeping its settings in its own file. PlasmaZones serves the placement API on KWin, and the Phosphor compositor is the intended second host. A settings module reads the descriptors to find the file to edit whether or not the host runs.

Member Function Documentation

◆ parse()

std::optional< HostDescriptor > PhosphorConfig::HostDescriptor::parse ( const QJsonObject & json,
QString * error )
staticnodiscard

Parse json.

Returns nullopt and sets error when a field is missing or invalid. Desktops may be left out, and a key that is not one of the descriptor's is ignored.

◆ resolvedConfigPath()

QString PhosphorConfig::HostDescriptor::resolvedConfigPath ( ) const
nodiscard

configPath with its leading variable expanded for this user.

Empty when the variable is unknown, the result is not absolute, or it contains a . or .. segment. Also empty when no path follows the variable, a segment of it is empty, or it holds an ASCII control character (U+0000 to U+001F, or U+007F).

Member Data Documentation

◆ backend

QString PhosphorConfig::HostDescriptor::backend

The PhosphorConfig backend the file uses. Only json is known.

◆ busName

QString PhosphorConfig::HostDescriptor::busName

The bus name the host owns while it runs.

HostDirectory::resolve() takes the pid of one owner, so the hosts of one API are expected to share this name. Nothing checks that they do.

◆ configPath

QString PhosphorConfig::HostDescriptor::configPath

The file: $XDG_CONFIG_HOME, $XDG_DATA_HOME, $XDG_STATE_HOME or $HOME, then / and a path with no empty, .

or .. segment and no ASCII control character. See resolvedConfigPath().

◆ desktops

QStringList PhosphorConfig::HostDescriptor::desktops

XDG_CURRENT_DESKTOP entries the host serves, compared ignoring case.

A host that declares none is never chosen or offered for a session's desktop. Only a record reaches it. See HostDirectory::resolve().

◆ id

QString PhosphorConfig::HostDescriptor::id

Matches [a-z0-9][a-z0-9-]*.

Descriptors are keyed by this, not by the name of the file that holds them.

◆ name

QString PhosphorConfig::HostDescriptor::name

A product name, shown untranslated where a user chooses between hosts.


The documentation for this struct was generated from the following file: