repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

quickshell/nuguland/shell.qml

Raw
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Wayland

ShellRoot {
    id: shell

    Theme {
        id: nuguTheme

        lowPowerMode: power.lowPowerMode()
    }

    Time {
        id: time
    }

    Niri {
        id: niri
    }

    Resources {
        id: resources
    }

    Notifications {
        id: notifications
    }

    Tray {
        id: tray
    }

    Clipboard {
        id: clipboard
    }

    Launcher {
        id: launcher

        niriService: niri
        clipboardService: clipboard
    }

    Osd {
        id: osd
    }

    Media {
        id: media

        osdService: osd
        audioService: audio
    }

    Audio {
        id: audio

        osdService: osd
    }

    Brightness {
        id: brightness

        osdService: osd
    }

    Idle {
        id: idle
    }

    Privilege {
        id: privilege
    }

    Lock {
        id: lock

        theme: nuguTheme
        timeService: time
        mediaService: media
        notificationService: notifications
        powerService: power
    }

    Network {
        id: network
    }

    Bluetooth {
        id: bluetooth
    }

    Power {
        id: power

        lockService: lock
        niriService: niri
    }

    Screenshots {
        id: screenshots

        niriService: niri
        osdService: osd
    }

    SurfaceManager {
        id: surfaceManager
    }

    Usage {
        id: usage
    }

    Variants {
        model: Quickshell.screens

        delegate: Component {
            PanelWindow {
                required property var modelData

                objectName: "osdOverlaySurface"
                screen: modelData
                visible: osd.visibleState
                implicitWidth: 320
                implicitHeight: 88
                color: "transparent"
                exclusionMode: ExclusionMode.Ignore
                WlrLayershell.layer: WlrLayer.Overlay
                WlrLayershell.namespace: "nuguland-osd"
                WlrLayershell.keyboardFocus: WlrKeyboardFocus.None

                anchors {
                    top: true
                    right: true
                }

                margins {
                    top: 48
                    right: 16
                }

                Rectangle {
                    id: osdCard

                    readonly property var indicator: osd.valueIndicator(osd.currentEvent, osd.currentValue)
                    readonly property string roleColor: osd.currentRole === "error" ? nuguTheme.error : (osd.currentRole === "warning" ? nuguTheme.warning : nuguTheme.ui.accent)

                    anchors.fill: parent
                    anchors.margins: 8
                    radius: 20
                    color: nuguTheme.withAlpha(nuguTheme.ui.backdrop, 0.94)
                    border.width: 0
                    border.color: roleColor
                    opacity: osd.visibleState ? 1 : 0

                    Rectangle {
                        id: osdIcon

                        anchors.left: parent.left
                        anchors.leftMargin: 14
                        anchors.verticalCenter: parent.verticalCenter
                        width: 42
                        height: 42
                        radius: 14
                        color: nuguTheme.withAlpha(osdCard.roleColor, 0.2)
                        border.width: 0
                        border.color: osdCard.roleColor

                        Text {
                            anchors.centerIn: parent
                            color: nuguTheme.content.normal
                            font.family: "IBM Plex Mono"
                            font.pixelSize: 13
                            font.bold: true
                            text: String(osdCard.indicator.iconRole || "osd").slice(0, 2)
                        }

                    }

                    Column {
                        anchors.left: osdIcon.right
                        anchors.leftMargin: 12
                        anchors.right: parent.right
                        anchors.rightMargin: 14
                        anchors.verticalCenter: parent.verticalCenter
                        spacing: 6

                        Row {
                            width: parent.width
                            spacing: 8

                            Text {
                                color: nuguTheme.content.normal
                                font.family: "IBM Plex Sans"
                                font.pixelSize: 15
                                font.bold: true
                                text: osd.currentEvent.length > 0 ? osd.currentEvent : "osd"
                                width: parent.width - valueText.width - parent.spacing
                                elide: Text.ElideRight
                            }

                            Text {
                                id: valueText

                                color: nuguTheme.ui.normal
                                font.family: "IBM Plex Mono"
                                font.pixelSize: 13
                                text: osd.currentValue
                            }

                        }

                        Rectangle {
                            width: parent.width
                            height: osdCard.indicator.progressBar && osdCard.indicator.progressBar.visible ? 8 : 0
                            visible: height > 0
                            radius: 4
                            color: nuguTheme.withAlpha(nuguTheme.ui.minor, 0.3)

                            Rectangle {
                                anchors.left: parent.left
                                anchors.top: parent.top
                                anchors.bottom: parent.bottom
                                width: parent.width * Math.max(0, Math.min(1, osdCard.indicator.normalizedValue || 0))
                                radius: parent.radius
                                color: osdCard.roleColor
                            }

                        }

                        Text {
                            visible: osd.currentRole === "error"
                            color: nuguTheme.error
                            font.family: "IBM Plex Sans"
                            font.pixelSize: 12
                            text: osd.currentValue
                            width: parent.width
                            elide: Text.ElideRight
                        }

                    }

                    Behavior on opacity {
                        NumberAnimation {
                            duration: nuguTheme.lowPowerMode ? 0 : 120
                            easing.type: Easing.OutCubic
                        }

                    }

                }

                mask: Region {
                }

            }

        }

    }

    Variants {
        model: Quickshell.screens

        delegate: Component {
            PanelWindow {
                required property var modelData

                objectName: "privilegeSecuritySurface"
                screen: modelData
                visible: privilege.active || privilege.error.length > 0
                color: "transparent"
                exclusionMode: ExclusionMode.Ignore
                WlrLayershell.layer: WlrLayer.Overlay
                WlrLayershell.namespace: "nuguland-privilege"
                WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive

                anchors {
                    top: true
                    bottom: true
                    left: true
                    right: true
                }

                PrivilegeSurface {
                    anchors.fill: parent
                    theme: nuguTheme
                    privilegeService: privilege
                }

            }

        }

    }

    Variants {
        model: Quickshell.screens

        delegate: Component {
            AuroraBackdrop {
                required property var modelData

                screen: modelData
                resourceService: resources
                lowPowerMode: power.lowPowerMode()
            }

        }

    }

    Variants {
        model: Quickshell.screens

        delegate: Component {
            Bar {
                required property var modelData

                screen: modelData
                theme: nuguTheme
                niriService: niri
                timeService: time
                resourceService: resources
                notificationService: notifications
                trayService: tray
                mediaService: media
                clipboardService: clipboard
                launcherService: launcher
                audioService: audio
                brightnessService: brightness
                networkService: network
                bluetoothService: bluetooth
                powerService: power
                idleService: idle
                lockService: lock
                surfaces: surfaceManager
                usageService: usage
            }

        }

    }

    IpcHandler {
        function increase() {
            return audio.increase();
        }

        function decrease() {
            return audio.decrease();
        }

        function muteOutput() {
            return audio.muteOutput();
        }

        function muteInput() {
            return audio.muteInput();
        }

        function route(action: string) : string {
            return audio.route(action);
        }

        target: "volume"
    }

    IpcHandler {
        function next() {
            return media.action("next");
        }

        function previous() {
            return media.action("previous");
        }

        function playPause() {
            return media.action("playPause");
        }

        function stop() {
            return media.action("stop");
        }

        function shuffle() {
            return media.action("shuffle");
        }

        function repeat() {
            return media.action("repeat");
        }

        function route(action: string) : string {
            return media.action(action);
        }

        target: "media"
    }

    IpcHandler {
        function increase() : string {
            return brightness.increase();
        }

        function decrease() : string {
            return brightness.decrease();
        }

        target: "brightness"
    }

    IpcHandler {
        function usageState() : string {
            return usage.stateJson();
        }

        function record(name: string) : string {
            return usage.record(name);
        }

        target: "usage"
    }

    IpcHandler {
        function ping() : string {
            return "nuguland";
        }

        function niriState() : string {
            return niri.stateJson();
        }

        function reloadTheme() {
            nuguTheme.reload();
            return nuguTheme.mode;
        }

        function screenshotScreen(path: string) : string {
            niri.screenshotScreen(path);
            return path;
        }

        function windowRuleMetadata() : string {
            return niri.windowRuleMetadata();
        }

        function windowCardAction(kind: string) : string {
            return niri.windowCardAction(kind);
        }

        function openWindow() : string {
            return surfaceManager.openRegisteredPopout("window");
        }

        function timeState() : string {
            return time.stateJson();
        }

        function timeStateAt(iso: string) : string {
            return time.stateAt(iso);
        }

        function timeRelative(fromIso: string, toIso: string) : string {
            return time.relative(fromIso, toIso);
        }

        function timeCalendar(year: int, month: int, selectedDay: int) : string {
            return time.calendar(year, month, selectedDay);
        }

        function openClock() : string {
            return surfaceManager.openRegisteredPopout("clock");
        }

        function systemWidgetState() : string {
            return resources.systemWidgetState();
        }

        function openSystem() : string {
            return surfaceManager.openRegisteredPopout("system");
        }

        function resourceHeroCard(kind: string, value: real, samplesCsv: string) : string {
            return resources.resourceHeroCard(kind, value, String(samplesCsv).split(",").map(Number));
        }

        function firestormState() : string {
            return resources.firestormState();
        }

        function systemLaunchBtm() : string {
            return resources.launchBtm();
        }

        function notificationWidgetState(attention: bool, active: bool) : string {
            return notifications.widgetState(attention, active);
        }

        function notificationsState() : string {
            return notifications.stateJson();
        }

        function notificationsToggleDnd() : string {
            return notifications.toggleDnd();
        }

        function notificationsAction(id: string, actionId: string) : string {
            return notifications.runAction(id, actionId);
        }

        function notificationsToggleGroup(appName: string) : string {
            return notifications.toggleGroup(appName);
        }

        function notificationsDrag(id: string, deltaX: real, width: real) : string {
            return notifications.dragNotification(id, deltaX, width);
        }

        function notificationsDiscardAll() : string {
            return notifications.discardAllNotifications();
        }

        function trayWidgetState(attention: bool, active: bool) : string {
            return tray.widgetState(attention, active);
        }

        function trayState() : string {
            return tray.stateJson();
        }

        function openTray() : string {
            return surfaceManager.openRegisteredPopout("tray");
        }

        function traySelectItem(id: string) : string {
            return tray.selectItem(id);
        }

        function trayMenuExpand(id: string) : string {
            return tray.expandSubmenu(id);
        }

        function trayMenuActivate(id: string) : string {
            return tray.activateRow(id);
        }

        function trayMenuClose(reason: string) : string {
            return tray.closeMenu(reason);
        }

        function launcherSearch(query: string) : string {
            return launcher.search(query);
        }

        function launcherState() : string {
            return launcher.stateJson();
        }

        function launcherLaunchRecord(rowJson: string) : string {
            return launcher.launchRecord(rowJson);
        }

        function launcherActivate(rowJson: string) : string {
            return launcher.activate(rowJson);
        }

        function launcherActivateFirst(query: string) : string {
            return launcher.activateFirst(query);
        }

        function launcherActivateId(id: string) : string {
            return launcher.activateId(id);
        }

        function hotkey(id: string) : string {
            return launcher.hotkey(id);
        }

        function openLauncher() : string {
            return surfaceManager.openRegisteredPopout("launcher");
        }

        function osdTrigger(event: string, value: string) : string {
            return osd.trigger(event, value);
        }

        function osdState() : string {
            return osd.stateJson();
        }

        function osdExpire() : string {
            return osd.expire();
        }

        function clipboardState() : string {
            return clipboard.stateJson();
        }

        function clipboardSearch(query: string) : string {
            return clipboard.search(query);
        }

        function clipboardTogglePin(id: string) : string {
            return clipboard.togglePin(id);
        }

        function clipboardCopy(id: string) : string {
            return clipboard.copy(id);
        }

        function clipboardPaste(id: string) : string {
            return clipboard.paste(id);
        }

        function clipboardDelete(id: string) : string {
            return clipboard.deleteRow(id);
        }

        function clipboardPrivateMode(enabled: bool) : string {
            return clipboard.setPrivateMode(enabled);
        }

        function openClipboard() : string {
            return surfaceManager.openRegisteredPopout("clipboard");
        }

        function mediaState() : string {
            return media.stateJson();
        }

        function openMedia() : string {
            return surfaceManager.openRegisteredPopout("media");
        }

        function mediaAction(kind: string) : string {
            return media.action(kind);
        }

        function mediaSeek(position: real) : string {
            return media.seek(position);
        }

        function mediaSelect(id: string) : string {
            return media.select(id);
        }

        function audioState() : string {
            return audio.stateJson();
        }

        function openAudio() : string {
            return surfaceManager.openRegisteredPopout("audio");
        }

        function privacyWidgetState() : string {
            return audio.privacyWidgetJson();
        }

        function audioSetVolume(id: string, volume: real) : string {
            return audio.setVolume(id, volume);
        }

        function audioToggleMute(id: string) : string {
            return audio.toggleMute(id);
        }

        function audioSetDefaultSink(id: string) : string {
            return audio.setDefaultSink(id);
        }

        function audioSetDefaultSource(id: string) : string {
            return audio.setDefaultSource(id);
        }

        function audioMoveStream(id: string, target: string) : string {
            return audio.moveStream(id, target);
        }

        function brightnessState() : string {
            return brightness.stateJson();
        }

        function openBrightness() : string {
            return surfaceManager.openRegisteredPopout("brightness");
        }

        function brightnessSetLevel(level: string) : string {
            return brightness.setLevel(level);
        }

        function brightnessIncrease() : string {
            return brightness.increase();
        }

        function brightnessDecrease() : string {
            return brightness.decrease();
        }

        function idleState() : string {
            return idle.stateJson();
        }

        function idleToggle() : string {
            return idle.toggle();
        }

        function idleDisable() : string {
            return idle.disable();
        }

        function privilegeState() : string {
            return privilege.stateJson();
        }

        function privilegeSubmit(secret: string) : string {
            return privilege.submit(secret);
        }

        function privilegeDeny() : string {
            return privilege.deny();
        }

        function privilegeCancel() : string {
            return privilege.cancel();
        }

        function privilegeFail(message: string) : string {
            return privilege.fail(message);
        }

        function privilegeClear() : string {
            return privilege.clear();
        }

        function lockState() : string {
            return lock.stateJson();
        }

        function lockRequest() : string {
            return lock.request();
        }

        function lockType(secret: string) : string {
            return lock.typeSecret(secret);
        }

        function lockSubmit(secret: string) : string {
            return lock.submit(secret);
        }

        function lockCancel() : string {
            return lock.cancel();
        }

        function networkState() : string {
            return network.stateJson();
        }

        function networkWidgetState() : string {
            const state = JSON.parse(network.stateJson());
            state.barLabel = "network";
            state.shader.values = [resources.networkRxLevel(), resources.networkTxLevel(), state.compact.signal / 100, state.wifi.enabled ? 1 : 0];
            state.shader.history = resources.shaderHistoryObject(resources.networkHistorySamples);
            state.rates = {
                "rxRate": resources.networkRxRate,
                "txRate": resources.networkTxRate,
                "rxLevel": resources.networkRxLevel(),
                "txLevel": resources.networkTxLevel()
            };
            return JSON.stringify(state);
        }

        function networkScan() {
            return network.scan();
        }

        function networkSelect(id: string) : string {
            return network.select(id);
        }

        function networkToggleWifi(enabled: bool) : string {
            return network.toggleWifi(enabled);
        }

        function networkForget(id: string) : string {
            return network.forget(id);
        }

        function networkCheckConnectivity() {
            return network.checkConnectivity();
        }

        function bluetoothState() : string {
            return bluetooth.stateJson();
        }

        function bluetoothScan() : string {
            return bluetooth.scan();
        }

        function bluetoothToggle(enabled: bool) : string {
            return bluetooth.toggle(enabled);
        }

        function bluetoothDeviceAction(kind: string, id: string) : string {
            return bluetooth.deviceAction(kind, id);
        }

        function powerState() : string {
            return power.stateJson();
        }

        function openPower() : string {
            return surfaceManager.openRegisteredPopout("power");
        }

        function openNetwork() : string {
            return surfaceManager.openRegisteredPopout("connectivity");
        }

        function powerSetProfile(name: string) : string {
            return power.setProfile(name);
        }

        function powerSessionAction(kind: string) : string {
            return power.sessionAction(kind);
        }

        function powerConfirmAction(kind: string) : string {
            return power.confirmAction(kind);
        }

        function powerCancelAction() : string {
            return power.cancelAction();
        }

        function screenshotsState() : string {
            return screenshots.stateJson();
        }

        function screenshotsBeginSelection(x: real, y: real) : string {
            return screenshots.beginSelection(x, y);
        }

        function screenshotsUpdateSelection(x: real, y: real) : string {
            return screenshots.updateSelection(x, y);
        }

        function screenshotsCompleteSelection(path: string) : string {
            return screenshots.completeSelection(path);
        }

        function screenshotsCancelSelection() : string {
            return screenshots.cancelSelection();
        }

        function screenshotsCapture(kind: string, path: string) : string {
            return screenshots.capture(kind, path);
        }

        function screenshotsPickColor() : string {
            return screenshots.pickColor();
        }

        function screenshotsRecordAction(kind: string, id: string) : string {
            return screenshots.recordAction(kind, id);
        }

        function screenshotsClear() : string {
            return screenshots.clear();
        }

        function openScreenshots() : string {
            return surfaceManager.openRegisteredPopout("screenshots");
        }

        function registeredAnchors() : string {
            return surfaceManager.registeredAnchors();
        }

        function popoutContentCatalog() : string {
            return surfaceManager.popoutContentCatalog();
        }

        function setPopoutScreen(width: int, height: int) : string {
            return surfaceManager.setPopoutScreen(width, height);
        }

        function openPopout(name: string, anchor: string) : string {
            return surfaceManager.openPopout(name, anchor);
        }

        function openRegisteredPopout(name: string) : string {
            return surfaceManager.openRegisteredPopout(name);
        }

        function openNotifications() : string {
            return surfaceManager.openRegisteredPopout("notifications");
        }

        function hoverRegisteredPopout(name: string) : string {
            return surfaceManager.hoverRegisteredPopout(name);
        }

        function closePopout() : string {
            return surfaceManager.closePopout("");
        }

        function popoutInteraction(kind: string) : string {
            return surfaceManager.popoutInteraction(kind);
        }

        function popoutState() : string {
            return surfaceManager.popoutState();
        }

        function hideAll() {
            surfaceManager.closePopout("hideAll");
            return "ok";
        }

        target: "nuguland"
    }

    component NuguText: Text {
        required property QtObject theme
        property string variant: "body"
        property bool selected: false

        color: !theme ? "transparent" : (selected ? theme.content.backdrop : (variant === "title" ? theme.ui.important_global : (variant === "meta" ? theme.ui.normal : theme.content.normal)))
        font.family: variant === "mono" ? "IBM Plex Mono" : "IBM Plex Sans"
        font.pixelSize: variant === "title" ? 15 : (variant === "meta" ? 13 : 14)
        font.bold: variant === "title"
        elide: Text.ElideRight
    }

    component PrivilegeFailureShake: Item {
        id: shakeRoot

        default property alias content: contentItem.data
        property bool active: false
        property real boundedDistance: 12
        readonly property var shakeOffsets: [0, -boundedDistance, boundedDistance, -boundedDistance / 2, boundedDistance / 2, 0]

        implicitWidth: contentItem.implicitWidth
        implicitHeight: contentItem.implicitHeight
        onActiveChanged: {
            if (active)
                shake.restart();

        }

        Item {
            id: contentItem

            anchors.fill: parent
            implicitWidth: childrenRect.width
            implicitHeight: childrenRect.height
        }

        SequentialAnimation {
            id: shake

            running: false
            alwaysRunToEnd: true

            ScriptAction {
                script: translation.x = shakeRoot.shakeOffsets[0]
            }

            NumberAnimation {
                target: translation
                property: "x"
                to: shakeRoot.shakeOffsets[1]
                duration: nuguTheme.lowPowerMode ? 0 : 50
                easing.type: Easing.OutCubic
            }

            NumberAnimation {
                target: translation
                property: "x"
                to: shakeRoot.shakeOffsets[2]
                duration: nuguTheme.lowPowerMode ? 0 : 50
                easing.type: Easing.OutCubic
            }

            NumberAnimation {
                target: translation
                property: "x"
                to: shakeRoot.shakeOffsets[3]
                duration: nuguTheme.lowPowerMode ? 0 : 40
                easing.type: Easing.OutCubic
            }

            NumberAnimation {
                target: translation
                property: "x"
                to: shakeRoot.shakeOffsets[4]
                duration: nuguTheme.lowPowerMode ? 0 : 40
                easing.type: Easing.OutCubic
            }

            NumberAnimation {
                target: translation
                property: "x"
                to: shakeRoot.shakeOffsets[5]
                duration: nuguTheme.lowPowerMode ? 0 : 30
                easing.type: Easing.OutCubic
            }

        }

        transform: Translate {
            id: translation

            x: 0
        }

    }

    component PrivilegeSurface: Rectangle {
        id: root

        required property QtObject theme
        required property QtObject privilegeService
        property var state: privilegeService ? parseJson(privilegeService.stateJson(), {
            "request": {
            },
            "privilegeSurfacePanelContract": {
            },
            "buttons": []
        }) : ({
            "request": {
            },
            "privilegeSurfacePanelContract": {
            },
            "buttons": []
        })
        readonly property var request: state.request || ({
        })
        readonly property var panel: state.privilegeSurfacePanelContract || ({
        })
        readonly property string source: "Quickshell Polkit manual agent.qml plus Nuguland Polkit.qml plus Nuguland PolkitService.qml"
        readonly property bool isolatedSecuritySurface: true
        readonly property bool requestIdentityCard: true
        readonly property bool secretPromptField: true
        readonly property bool denyCancelConfirmRow: true
        readonly property bool failureShakeSlot: true
        readonly property bool noDecorativeDistraction: true
        readonly property bool serviceFedOnly: true

        function parseJson(text, valueWhenInvalid) {
            try {
                return JSON.parse(String(text));
            } catch (error) {
                return valueWhenInvalid;
            }
        }

        function refreshFrom(text) {
            state = parseJson(text, state);
        }

        function submitSecret(secret) {
            if (privilegeService)
                refreshFrom(privilegeService.submit(secret));

        }

        function deny() {
            if (privilegeService)
                refreshFrom(privilegeService.deny());

        }

        function cancel() {
            if (privilegeService)
                refreshFrom(privilegeService.cancel());

        }

        color: theme ? theme.withAlpha(theme.ui.backdrop, 0.94) : "black"
        visible: state.active || state.error.length > 0
        Keys.onEscapePressed: (event) => {
            event.accepted = true;
            root.cancel();
        }

        Rectangle {
            anchors.centerIn: parent
            width: Math.min(parent.width - 48, 560)
            height: Math.min(parent.height - 48, 370)
            radius: 22
            color: root.theme ? root.theme.ui.backdrop : "transparent"
            border.width: 0
            border.color: root.theme ? root.theme.warning : "transparent"

            Column {
                anchors.fill: parent
                anchors.margins: 22
                spacing: 12

                NuguText {
                    theme: root.theme
                    variant: "meta"
                    text: "authentication required"
                    width: parent.width
                    wrapMode: Text.WordWrap
                }

                Rectangle {
                    objectName: "requestIdentityCard"
                    width: parent.width
                    height: 94
                    radius: 15
                    color: root.theme ? root.theme.withAlpha(root.theme.warning, 0.14) : "transparent"
                    border.width: 0
                    border.color: root.theme ? root.theme.warning : "transparent"

                    Column {
                        anchors.fill: parent
                        anchors.margins: 12
                        spacing: 5

                        NuguText {
                            theme: root.theme
                            variant: "title"
                            text: root.request.app || "polkit"
                            width: parent.width
                            elide: Text.ElideRight
                        }

                        NuguText {
                            theme: root.theme
                            text: root.request.message || "Authentication required"
                            width: parent.width
                            elide: Text.ElideRight
                        }

                        NuguText {
                            theme: root.theme
                            variant: "meta"
                            text: root.request.actionId || "native Polkit request"
                            width: parent.width
                            elide: Text.ElideMiddle
                        }

                    }

                }

                PrivilegeFailureShake {
                    objectName: "failureShakeSlot"
                    active: root.state.error && root.state.error.length > 0
                    width: parent.width
                    height: secretBox.height

                    Rectangle {
                        id: secretBox

                        objectName: "secretPromptField"
                        width: parent.width
                        height: 46
                        radius: 23
                        color: root.theme ? root.theme.withAlpha(root.state.error ? root.theme.error : root.theme.ui.focus, root.state.error ? 0.18 : 0.12) : "transparent"
                        border.width: 0
                        border.color: root.theme ? (root.state.error ? root.theme.error : root.theme.ui.focus) : "transparent"

                        NuguText {
                            anchors.left: parent.left
                            anchors.leftMargin: 14
                            anchors.verticalCenter: parent.verticalCenter
                            theme: root.theme
                            variant: "meta"
                            text: root.request.prompt || "Password"
                            opacity: 0.74
                        }

                        TextInput {
                            id: secretInput

                            anchors.left: parent.left
                            anchors.leftMargin: 106
                            anchors.right: parent.right
                            anchors.rightMargin: 14
                            anchors.verticalCenter: parent.verticalCenter
                            color: root.theme ? root.theme.content.normal : "white"
                            selectionColor: root.theme ? root.theme.ui.focus : "white"
                            selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
                            font.family: "IBM Plex Mono"
                            echoMode: root.request.responseVisible ? TextInput.Normal : TextInput.Password
                            inputMethodHints: Qt.ImhSensitiveData
                            focus: root.state.active
                            onActiveFocusChanged: {
                                if (!activeFocus && root.state.active)
                                    forceActiveFocus();

                            }
                            Keys.onReturnPressed: (event) => {
                                event.accepted = true;
                                root.submitSecret(text);
                                text = "";
                            }
                            Keys.onEnterPressed: (event) => {
                                event.accepted = true;
                                root.submitSecret(text);
                                text = "";
                            }
                            Keys.onEscapePressed: (event) => {
                                event.accepted = true;
                                root.cancel();
                                text = "";
                            }
                        }

                    }

                }

                NuguText {
                    theme: root.theme
                    variant: "meta"
                    text: root.state.error || "No decoration. No command construction. Native Polkit route."
                    width: parent.width
                    color: root.state.error && root.theme ? root.theme.error : (root.theme ? root.theme.content.normal : "white")
                    elide: Text.ElideRight
                }

                Row {
                    objectName: "denyCancelConfirmRow"
                    width: parent.width
                    spacing: 8

                    Repeater {
                        model: ["deny", "cancel", "confirm"]

                        delegate: Rectangle {
                            id: action

                            required property string modelData

                            width: Math.floor((parent.width - 16) / 3)
                            height: 38
                            radius: 12
                            color: root.theme ? root.theme.withAlpha(action.modelData === "confirm" ? root.theme.ui.focus : root.theme.ui.minor, action.modelData === "confirm" ? 0.16 : 0.1) : "transparent"
                            border.width: 0
                            border.color: root.theme ? (action.modelData === "confirm" ? root.theme.ui.focus : root.theme.ui.minor) : "transparent"

                            NuguText {
                                anchors.centerIn: parent
                                theme: root.theme
                                variant: "meta"
                                selected: action.modelData === "confirm"
                                text: action.modelData
                            }

                            MouseArea {
                                anchors.fill: parent
                                onClicked: {
                                    if (action.modelData === "deny") {
                                        root.deny();
                                    } else if (action.modelData === "cancel") {
                                        root.cancel();
                                    } else {
                                        root.submitSecret(secretInput.text);
                                        secretInput.text = "";
                                    }
                                }
                            }

                        }

                    }

                }

            }

        }

    }

}