Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skills/optional/quickshell/examples/03-clock/shell.qml

Raw
// 03-clock/shell.qml
// A floating-style clock panel: appears at top-center of the focused monitor.
// Uses PanelWindow (not FloatingWindow) so we get anchors + margins + layer-shell by default.
// Run with: qs -p examples/03-clock/shell.qml

import QtQuick
import Quickshell

PanelWindow {
    // Center horizontally via margins; no `anchors.horizontalCenter` on PanelWindow.
    anchors { top: true }
    margins {
        top: 60
        left: (screen.width - implicitWidth) / 2
    }

    implicitWidth: 380
    implicitHeight: 90
    color: "#dd1e1e2e"

    // Do not reserve screen space because this is an overlay, not a bar.
    exclusiveZone: 0

    // Round corners via an inner Rectangle (PanelWindow itself can't be rounded).
    Rectangle {
        anchors.fill: parent
        radius: 12
        color: "transparent"  // fill the panel

        Column {
            anchors.centerIn: parent
            spacing: 4

            SystemClock {
                id: clock
                precision: SystemClock.Seconds
            }

            Text {
                text: Qt.formatTime(clock.date, "HH:mm:ss")
                color: "white"
                font.pointSize: 28
                font.bold: true
                anchors.horizontalCenter: parent.horizontalCenter
            }

            Text {
                text: Qt.formatDate(clock.date, "dddd, MMMM d")
                color: "#ccd0d0d0"
                font.pointSize: 12
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }
    }
}