Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/features/tray/fixtures/services/Tray.qml

Raw
import QtQuick

Item {
    property bool empty: false
    // Adversarial item: no title, only the generated id an Electron app sends.
    property bool idOnly: false
    // An item that offers no menu.
    property bool noMenu: false
    readonly property int itemCount: empty ? 0 : 1
    readonly property int attentionCount: empty ? 0 : 1
    property int primaryCount: 0
    property int secondaryCount: 0
    property int menuCount: 0

    readonly property var items: empty ? [] : [
        {
            "id": idOnly ? "chrome_status_icon_1" : "tray-fixture",
            "title": idOnly ? "" : "fixture tray",
            "tooltipTitle": idOnly ? "" : "fixture tray",
            "tooltipDescription": "synthetic status",
            "icon": "",
            "status": "NeedsAttention",
            "category": "ApplicationStatus",
            "hasMenu": !noMenu,
            "onlyMenu": false
        }
    ]

    function menuFor(id) {
        return null;
    }

    function primaryActivate(id, window, x, y) {
        primaryCount++;
    }

    function secondaryActivate(id) {
        secondaryCount++;
    }

    function displayMenu(id, window, x, y) {
        menuCount++;
    }

    // Fixture surface for `features/tray/fixtures/suite.mjs` and the shared task fixture.
    function fixtureState() {
        return {
            "empty": empty,
            "primaryCount": primaryCount,
            "secondaryCount": secondaryCount,
            "menuCount": menuCount
        };
    }

    function setIdOnly(value) {
        idOnly = value === true;
    }

    function setNoMenu(value) {
        noMenu = value === true;
    }

    function setEmpty(value) {
        empty = value === true;
    }
}