repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

skills/quickshell/examples/03-clock/shell.qml

Raw
// 03-clock/shell.qml
// A floating, always-on-top clock in a FloatingWindow using WlrLayer.Overlay.
// Run with: qs -p examples/03-clock/shell.qml

import QtQuick
import Quickshell
import Quickshell.Wayland

FloatingWindow {
    width: 380
    height: 90
    color: "#dd1e1e2e"
    radius: 12                              // not actually rounded; see below

    // Place at top-center of the focused monitor.
    anchors {
        top: true
        horizontalCenter: true
    }
    margins.top: 60

    // Float over fullscreen apps.
    WlrLayershell.layer: WlrLayer.Overlay
    WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
    WlrLayershell.namespace: "qs-example-clock"

    Column {
        anchors.centerIn: parent
        spacing: 4

        // Big time, live.
        Text {
            text: SystemClock.time.toLocaleString(Qt.locale(), "HH:mm:ss")
            color: "white"
            font.pointSize: 28
            font.bold: true
            anchors.horizontalCenter: parent.horizontalCenter
        }

        // Date below.
        Text {
            text: SystemClock.date.toLocaleDateString(Qt.locale(), Locale.LongFormat)
            color: "#ccd0d0d0"
            font.pointSize: 12
            anchors.horizontalCenter: parent.horizontalCenter
        }
    }
}