summaryrefslogtreecommitdiffstats
path: root/desktop/modules/shells/ShellsPage.qml
blob: abbb2b1f1280ece396b8e3688b141cb1f5c0a9e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

import QtQuick
import "../.."
import "../ai"

// One row per shell, Restart when it runs and Start when it does not, both
// through reload.sh. The desktop row restarts the process drawing this page.
Column {
    id: page

    required property var shells

    spacing: 8

    Component.onCompleted: page.shells.refresh()

    AiRow {
        width: page.width
        title: "All shells"
        detail: "Restarts every one, this window included"
        on: true
        action: "Restart all"
        onTriggered: page.shells.restart("")
    }

    Repeater {
        model: page.shells.shells

        AiRow {
            required property var modelData
            objectName: "shell:" + modelData.name
            width: page.width
            title: modelData.name
            on: modelData.running
            detail: (modelData.running ? "Running" : "Stopped")
                + (modelData.name === "desktop" ? " · hosts this window" : "")
            action: modelData.running ? "Restart" : "Start"
            onTriggered: page.shells.restart(modelData.name)
        }
    }
}