Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/FeatureEntry.qml

Raw
import QtQuick

// One registry feature: data the host reads, never host logic. SurfaceManager
// computes geometry from the sizes; PopupHost instantiates the bound panel;
// Bar renders the chip of every popup and toggle entry.
QtObject {
    // Stable ID: popup name, bar chip name, and `features/<name>/` directory.
    required property string name
    // Service created by the registry at startup. Registry.qml also exposes it as a
    // typed property for explicit IPC and cross-feature injection in shell.qml.
    required property QtObject service
    // Panel bound by the registry to its theme and service; the host only loads it.
    // Every popup and overlay entry declares one; a toggle entry has none.
    property Component panel: null
    // Optional configuration declaration, created once with the service, not per screen.
    property ConfigSection configuration: null
    // Popup card size, including its padding, before the host's screen budget:
    // the panel gets `width - 48` by up to `height - 48` (16 px card inset plus
    // 16 px margins per side). `height` is the maximum: a panel that declares
    // `property real naturalHeight`, the height that shows all its content
    // without scrolling, gets a card that fits it, so short states stay compact
    // and longer content scrolls inside the maximum. Bind it to content sizes,
    // e.g. a Flickable's `contentHeight`, never to the panel's own height. The
    // card takes its fitted size at once on open and switch, and animates later
    // content changes in at most 130 ms, none in low-power mode. A panel without
    // it gets the full `height`, e.g. a search panel whose results change as
    // the user types.
    property int width: 520
    property int height: 300
    // Empty state: while true the host shrinks the popup to its shared compact
    // empty size; bind it to the service, e.g. no items to show.
    property bool empty: false
    // Session view state: the host saves and restores the panel's same-named
    // properties across close, switch and reload; `scrollY` is the viewport offset,
    // and an entry that leaves it out opens its panel at the top every time.
    // A panel that declares `property var sessionState` instead receives the
    // host's live copy of this object on load and keeps it current itself, e.g.
    // a search query; the host then copies no same-named properties for it.
    property var retainedState: ({
            "scrollY": 0
        })
    // Bar control: the shared bar chip's label and activity dot.
    property string barLabel: name
    // The chip's tooltip and accessible name, and the tooltip of an own bar
    // control: the full lowercase feature name.
    property string barTitle: name
    // The chip's Nerd Font glyph, which replaces `barLabel` on a vertical bar; bind
    // it to state that changes the chip's meaning, e.g. microphone in use.
    property string barIcon: ""
    // At most two characters beside the glyph on a vertical bar, for state the
    // horizontal label spells out, e.g. an attention count; empty for none.
    property string barBadge: ""
    property bool barActive: false
    // Bar emphasis, read by the chip of every entry: `barStrong` replaces the dot
    // with a tinted, bordered chip and bold label, e.g. setup required;
    // `barRole` colours dot, emphasis and busy line: "warning" the theme's warning
    // colour, with an exclamation mark in place of the dot, any other role the accent; `barBusy` replaces the dot with a pulsing
    // underline while work runs, e.g. a capture (still, with low-power motion).
    property bool barStrong: false
    property string barRole: "ui.accent"
    property bool barBusy: false
    // Own bar presentation, for a popup entry instead of the shared chip: a
    // component whose root is a `BarControl` (BarControl.qml). Bar instantiates it
    // for every popup entry declaring it, in its end slot: at the right edge of a
    // horizontal bar, after the chips; centred on a vertical bar, kept 12 px above
    // the chips. Bar sets the control's `label` (barLabel), `selected` and
    // `vertical`, lays its shared state layer over it, toggles the popup on
    // activation, and registers the popup anchor. Such an entry stays out of the
    // usage-ordered chips (Usage.qml), e.g. the clock.
    property Component barControl: null
    // Controller kind; the host that owns the feature's surface reads it.
    // "popup": SurfaceManager and PopupHost, the default popup lifecycle.
    // "overlay": OverlayHost, a glance-only, keyboardless layer-shell surface on
    // the primary screen, `width` wide and as tall as the panel's implicit height,
    // mapped while `overlayShown` is true.
    // "toggle": Bar only, a chip without a surface: activating the chip records
    // its usage and emits `activated`, which the registry wires to a service
    // intent, e.g. keep-awake; it never opens, closes or replaces a popup.
    property string kind: "popup"
    property bool overlayShown: false
    // Focus overlay, for an entry of any kind: OverlayHost maps `focusOverlay` as a
    // glance-only, click-through, keyboardless layer-shell surface on the focused
    // output (the primary screen while niri reports none) while
    // `focusOverlayShown` is true, e.g. a capture indicator. The component fills
    // the output's area outside the bar; the host subtracts the bar's thickness on
    // the primary screen only.
    property Component focusOverlay: null
    property bool focusOverlayShown: false
    // Lifecycle: the host emits `opening` each time it opens this popup, switches
    // to it from another popup, or is asked to open it while open, before the
    // popup becomes active and never on close, e.g. to read context from the
    // focused application. It emits `dismissed` when this popup closes or another
    // popup replaces it, e.g. to cancel a pending confirmation; on a switch the
    // previous popup's `dismissed` precedes this popup's `opening`.
    // A panel that declares `signal closeRequested(string reason)` asks the host
    // to close its popup, e.g. after launching an app; the host hears only the
    // panel of the open popup and records `reason` as the close reason.
    // A panel that declares `property Item initialFocus` names the control where
    // its task starts, e.g. a volume slider; the host focuses it each time the
    // popup opens or switches in, once the popup window is active, and keeps the
    // restored scroll offset. Bind it to state, e.g. a setup action while setup
    // is needed; a null, hidden or disabled target leaves focus on the card.
    // A search panel focuses its own field instead.
    signal opening
    signal dismissed
    // Toggle entries only: Bar emits `activated` on every chip activation.
    signal activated
}