From c32e27b471e26ce0fc70d5cf35bb69aef34ef9a2 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:00:43 +0400 Subject: [PATCH] add clock --- config/quickshell/Time.qml | 41 ++++++++++++++++++++++++++++++++ config/quickshell/Workspaces.qml | 2 +- config/quickshell/shell.qml | 23 +++++++----------- 3 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 config/quickshell/Time.qml diff --git a/config/quickshell/Time.qml b/config/quickshell/Time.qml new file mode 100644 index 00000000..97b4e558 --- /dev/null +++ b/config/quickshell/Time.qml @@ -0,0 +1,41 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import Quickshell + +ListView { + id: root + + height: 110 + width: 60 + anchors.centerIn: parent + SystemClock { + id: clock + precision: SystemClock.Minutes + } + + Item { + width: parent.width + height: parent.height + anchors.centerIn: parent + + Rectangle { + width: 50 + height: 60 + anchors.centerIn: parent + Text { + Layout.alignment: Qt.AlignHCenter + anchors.centerIn: parent + text: { + const hours = clock.hours.toString().padStart(2, '0') + const minutes = clock.minutes.toString().padStart(2, '0') + return `${hours}\n${minutes}` + } + font.pointSize: 20 + color: "black" + } + + } + + } +} diff --git a/config/quickshell/Workspaces.qml b/config/quickshell/Workspaces.qml index a0a779a0..2bf338d2 100644 --- a/config/quickshell/Workspaces.qml +++ b/config/quickshell/Workspaces.qml @@ -15,7 +15,7 @@ ListView { model: workspaceArray anchors.top: parent.top anchors.centerIn: parent - height: 500 + height: 110 width: 60 spacing: 2 delegate: Item { diff --git a/config/quickshell/shell.qml b/config/quickshell/shell.qml index 8edd4318..118eef77 100644 --- a/config/quickshell/shell.qml +++ b/config/quickshell/shell.qml @@ -56,27 +56,22 @@ ShellRoot { // Center RowLayout { anchors.centerIn: parent - /* Text { */ - /* color: "#FFFFFF" */ - /* // now just time instead of root.time */ - /* text: time */ - /* } */ + Text { + color: "#FFFFFF" + // now just time instead of root.time + text: time + } } // right RowLayout { /* anchors.right: parent.right */ - /* anchors.top: parent.top */ anchors.bottom: parent.bottom spacing: 5 - - Battery { } - - Text { - color: "#FFFFFF" - text: "Right" - } + + Battery { } + Time { } } } @@ -84,7 +79,7 @@ ShellRoot { Process { id: dateProc - command: ["date"] + command: ["date", "+%I:%M%p %A, %b %e, %Y"] running: true stdout: SplitParser {