<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!--
  Written by lowtide, 2026. CC0 1.0: dedicated to the public domain.

  The Search and Settings charms, for the app in front.

  An app that wants its own search and settings serves this interface at
  /org/cont8nuum/Charms on the session bus, under a well-known name the
  same as its window's app_id (org.example.News: the name GApplication
  and QDBus apps own anyway). c8-shell is the caller, never the other
  way round, and only while one of the app's windows is the one in front
  (Start hidden). Apps that don't serve it keep the usual charms.

  Several copies of an app can run at once. Each asks for the name
  without DBUS_NAME_FLAG_DO_NOT_QUEUE, so the first owns it and the rest
  wait in the bus's queue. The shell lists the queue (ListQueuedOwners),
  takes the copy whose process id is the window's (the compositor tells
  it), and calls that copy by its unique name. If none matches (a
  sandbox's bus proxy has a pid of its own), the first copy is called.
  Within one copy, the app's own window that last had the keyboard is
  the one in front.

  c8ui apps get all of this from c8ui-charms.h; others serve it with
  whatever D-Bus library they have.

  Each call is made with a short timeout and no auto-start: an app that
  is slow to answer gets the usual charms that time. All methods are
  optional; a missing one (UnknownMethod) means the app doesn't do that.

  Search

  The Search charm (or Super+S) opens a pane at the right edge over the
  app, "Search" over the app's name, with a box. Search("") is called as
  it opens: an error means the app doesn't do search, and Start's search
  opens instead. What it returns shows under the empty box (recent
  searches, say), or nothing. Then Search is called again as the user
  types; only the answer to the latest query is shown.

  A result is a dictionary:
    id        the app's own key for it, handed back to ActivateResult
    title     the first line
    subtitle  the second line, dimmer; optional
    icon      an icon name or an absolute path; optional
  Unknown keys are ignored. The pane shows the first 50.

  Clicking a result, or Enter with one picked with the arrows, calls
  ActivateResult; Enter in the box calls Submit (or, if the app has no
  Submit, opens the first result). Either way the pane closes and the
  app shows what was asked for. "Search everywhere" in the pane takes
  the text to Start's search instead.

  Settings

  The Settings charm opens the flyout with "Settings" over the app's
  name, the app's commands (GetSettings) as links, and the shell's own
  quick settings below them. A command is (id, label, kind):

    page    clicking it shows a page of controls in the flyout, from
            GetSettingsPage(id), with a back arrow
    action  clicking it calls ActivateSettings(id) and closes the
            flyout: the app shows its own window (an About box, say)

  A page is a list of controls, each a dictionary:
    id           the control's key, handed back to SetSetting
    type         toggle    value b
                 choice    options as, value i: a drop-down list
                 buttons   options as, value i: a few side by side
                 slider    min d, max d, step d, value d
                 text      value s, placeholder s, password b
                 button    a button: SetSetting is called with b true
                 link      the same, drawn as a link
                 heading   a heading (label only)
                 paragraph a line or two of text (label only)
    label        what the control is called (the toggle's header, etc.)
    description  smaller text under a toggle; optional
    enabled      b, default true
  Values come back to the app with SetSetting, in the type given above,
  as they are changed: a slider once let go, text on Enter or when it
  loses focus. A control of an unknown type is skipped.

  SettingsChanged makes the shell ask again: for the commands (an empty
  command) or for that page, if it is showing. When the same controls
  come back (ids and types in the same order) they take their new values
  where they are, so a control can be enabled by another one; otherwise
  the page is built again.
-->
<node>
  <interface name="org.cont8nuum.Charms1">
    <method name="Search">
      <arg name="query" type="s" direction="in"/>
      <arg name="results" type="aa{sv}" direction="out"/>
    </method>
    <method name="ActivateResult">
      <arg name="id" type="s" direction="in"/>
      <arg name="query" type="s" direction="in"/>
    </method>
    <method name="Submit">
      <arg name="query" type="s" direction="in"/>
    </method>

    <method name="GetSettings">
      <arg name="commands" type="a(sss)" direction="out"/>
    </method>
    <method name="GetSettingsPage">
      <arg name="command" type="s" direction="in"/>
      <arg name="controls" type="aa{sv}" direction="out"/>
    </method>
    <method name="ActivateSettings">
      <arg name="command" type="s" direction="in"/>
    </method>
    <method name="SetSetting">
      <arg name="command" type="s" direction="in"/>
      <arg name="control" type="s" direction="in"/>
      <arg name="value" type="v" direction="in"/>
    </method>
    <signal name="SettingsChanged">
      <arg name="command" type="s"/>
    </signal>
  </interface>
</node>
