added three new modules (Crypto.qml, Battery.qml, Network.qml), improved Stats.qml, improved Tray.qml, optimized code in general, added a polkit agent, configurations change (check configs)
This commit is contained in:
@@ -2,6 +2,7 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Io
|
||||
|
||||
import "../../config" as Cfg
|
||||
|
||||
@@ -17,8 +18,44 @@ Rectangle {
|
||||
property int barMargin: Cfg.Config.margin
|
||||
|
||||
readonly property var t: Cfg.Config.theme
|
||||
readonly property string tz: Cfg.Config.timezone || ""
|
||||
|
||||
readonly property int tzOffsetHours: -timeManager.now.getTimezoneOffset() / 60
|
||||
|
||||
property int tzOffsetMin: 0
|
||||
|
||||
Process {
|
||||
id: tzProc
|
||||
command: ["bash", "-c", "TZ=" + (root.tz || "UTC") + " date +%z"]
|
||||
running: root.tz !== ""
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
var s = data.trim()
|
||||
if (s.length < 5) return
|
||||
var sign = (s[0] === "-") ? -1 : 1
|
||||
var h = parseInt(s.substring(1, 3), 10)
|
||||
var m = parseInt(s.substring(3, 5), 10)
|
||||
root.tzOffsetMin = sign * (h * 60 + m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1800000; running: root.tz !== ""; repeat: true
|
||||
onTriggered: tzProc.running = true
|
||||
}
|
||||
|
||||
function toTz(date) {
|
||||
if (!tz) return date
|
||||
|
||||
return new Date(date.getTime()
|
||||
+ date.getTimezoneOffset() * 60000
|
||||
+ tzOffsetMin * 60000)
|
||||
}
|
||||
|
||||
function tzOffsetHours() {
|
||||
if (!tz) return -timeManager.now.getTimezoneOffset() / 60
|
||||
return tzOffsetMin / 60
|
||||
}
|
||||
|
||||
width: clockLayout.implicitWidth + 24
|
||||
height: Cfg.Config.moduleHeight
|
||||
@@ -66,7 +103,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: timeManager.now.toLocaleTimeString(Qt.locale(), "HH:mm")
|
||||
text: root.toTz(timeManager.now).toLocaleTimeString(Qt.locale(), "HH:mm")
|
||||
color: root.t.clockTime
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
@@ -75,7 +112,7 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
id: secondsText
|
||||
text: ":" + timeManager.now.toLocaleTimeString(Qt.locale(), "ss")
|
||||
text: ":" + root.toTz(timeManager.now).toLocaleTimeString(Qt.locale(), "ss")
|
||||
color: root.t.clockSeconds
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
@@ -230,7 +267,7 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Text {
|
||||
text: timeManager.now.toLocaleDateString(Qt.locale(), "dddd")
|
||||
text: root.toTz(timeManager.now).toLocaleDateString(Qt.locale(), "dddd")
|
||||
color: root.t.clockPopupDim
|
||||
font.pixelSize: 12
|
||||
font.capitalization: Font.AllUppercase
|
||||
@@ -239,7 +276,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: timeManager.now.toLocaleDateString(Qt.locale(), "d MMMM yyyy")
|
||||
text: root.toTz(timeManager.now).toLocaleDateString(Qt.locale(), "d MMMM yyyy")
|
||||
color: root.t.clockPopupHeader
|
||||
font.pixelSize: 22
|
||||
font.bold: true
|
||||
@@ -269,8 +306,8 @@ Rectangle {
|
||||
id: cal
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: gridCol.implicitHeight
|
||||
property int displayYear: timeManager.now.getFullYear()
|
||||
property int displayMonth: timeManager.now.getMonth()
|
||||
property int displayYear: root.toTz(timeManager.now).getFullYear()
|
||||
property int displayMonth: root.toTz(timeManager.now).getMonth()
|
||||
property int pendingYear: displayYear
|
||||
property int pendingMonth: displayMonth
|
||||
property int slideDir: 1
|
||||
@@ -279,8 +316,9 @@ Rectangle {
|
||||
target: calendarPopup
|
||||
function onPopupOpenChanged() {
|
||||
if (calendarPopup.popupOpen) {
|
||||
cal.displayYear = timeManager.now.getFullYear()
|
||||
cal.displayMonth = timeManager.now.getMonth()
|
||||
let tzd = root.toTz(timeManager.now)
|
||||
cal.displayYear = tzd.getFullYear()
|
||||
cal.displayMonth = tzd.getMonth()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,7 +377,12 @@ Rectangle {
|
||||
width: (card.width - 32) / 7; height: 26
|
||||
readonly property int dayNum: (weekRow.weekIndex * 7 + index) - ((new Date(cal.displayYear, cal.displayMonth, 1).getDay() + 6) % 7) + 1
|
||||
readonly property bool inMonth: dayNum >= 1 && dayNum <= new Date(cal.displayYear, cal.displayMonth + 1, 0).getDate()
|
||||
readonly property bool isToday: inMonth && dayNum === timeManager.now.getDate() && cal.displayYear === timeManager.now.getFullYear() && cal.displayMonth === timeManager.now.getMonth()
|
||||
readonly property bool isToday: {
|
||||
let tzd = root.toTz(timeManager.now)
|
||||
return inMonth && dayNum === tzd.getDate()
|
||||
&& cal.displayYear === tzd.getFullYear()
|
||||
&& cal.displayMonth === tzd.getMonth()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent; width: 22; height: 22; radius: 11
|
||||
@@ -371,7 +414,7 @@ Rectangle {
|
||||
Layout.rightMargin: 6
|
||||
|
||||
Text {
|
||||
text: "UTC " + (root.tzOffsetHours >= 0 ? "+" : "") + root.tzOffsetHours
|
||||
text: "UTC " + (root.tzOffsetHours() >= 0 ? "+" : "") + root.tzOffsetHours()
|
||||
color: root.t.clockPopupUtc
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
@@ -382,11 +425,11 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
text: {
|
||||
let d = timeManager.now
|
||||
let d = root.toTz(timeManager.now)
|
||||
let month = d.getMonth() + 1
|
||||
let day = d.getDate()
|
||||
let year = d.getFullYear()
|
||||
if (Cfg.Config.clockDateFormat === "DMY")
|
||||
if (Cfg.Config.dateFormat === "DMY")
|
||||
return day + "/" + month + "/" + year
|
||||
return month + "/" + day + "/" + year
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user