summaryrefslogtreecommitdiff
path: root/modules/lock/Fetch.qml
blob: 755e7f8b3fb8457e962fd7706eaae718b3cf77ec (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
pragma ComponentBehavior: Bound

import qs.components
import qs.services
import qs.config
import qs.utils
import Quickshell
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts

ColumnLayout {
    id: root

    anchors.fill: parent
    anchors.margins: Appearance.padding.large * 2
    anchors.topMargin: Appearance.padding.large

    spacing: Appearance.spacing.small

    RowLayout {
        Layout.fillWidth: true
        Layout.fillHeight: false
        spacing: Appearance.spacing.normal

        StyledRect {
            implicitWidth: prompt.implicitWidth + Appearance.padding.normal * 2
            implicitHeight: prompt.implicitHeight + Appearance.padding.normal * 2

            color: Colours.palette.m3primary
            radius: Appearance.rounding.small

            MonoText {
                id: prompt

                anchors.centerIn: parent
                text: ">"
                font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal
                color: Colours.palette.m3onPrimary
            }
        }

        MonoText {
            Layout.fillWidth: true
            text: "caelestiafetch.sh"
            font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal
            elide: Text.ElideRight
        }

        Loader {
            Layout.fillHeight: true
            asynchronous: true
            active: !iconLoader.active
            visible: active

            sourceComponent: IconImage {
                source: Quickshell.iconPath(SysInfo.logo)
                implicitSize: height
            }
        }
    }

    RowLayout {
        Layout.fillWidth: true
        Layout.fillHeight: false
        spacing: height * 0.15

        Loader {
            id: iconLoader

            Layout.fillHeight: true

            asynchronous: true
            active: root.width > 320
            visible: active

            sourceComponent: IconImage {
                source: Quickshell.iconPath(SysInfo.logo)
                implicitSize: height
            }
        }

        ColumnLayout {
            Layout.fillWidth: true
            Layout.topMargin: Appearance.padding.normal
            Layout.bottomMargin: Appearance.padding.normal
            Layout.leftMargin: iconLoader.active ? 0 : width * 0.1
            spacing: Appearance.spacing.normal

            FetchText {
                text: `OS  : ${SysInfo.osPrettyName || SysInfo.osName}`
            }

            FetchText {
                text: `WM  : ${SysInfo.wm}`
            }

            FetchText {
                text: `USER: ${SysInfo.user}`
            }

            FetchText {
                text: `UP  : ${SysInfo.uptime}`
            }
        }
    }

    Loader {
        Layout.alignment: Qt.AlignHCenter

        asynchronous: true
        active: root.height > 220
        visible: active

        sourceComponent: RowLayout {
            spacing: Appearance.spacing.large

            Repeater {
                model: Math.min(8, root.width / (Appearance.font.size.larger * 2 + Appearance.spacing.large))

                StyledRect {
                    required property int index

                    implicitWidth: implicitHeight
                    implicitHeight: Appearance.font.size.larger * 2
                    color: Colours.palette[`term${index}`]
                    radius: Appearance.rounding.small
                }
            }
        }
    }

    component FetchText: MonoText {
        Layout.fillWidth: true
        font.pointSize: root.width > 400 ? Appearance.font.size.larger : Appearance.font.size.normal
        elide: Text.ElideRight
    }

    component MonoText: StyledText {
        font.family: Appearance.font.family.mono
    }
}