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:
@@ -1,9 +1,12 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Io
|
||||
import "../../config" as Cfg
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
required property var modelData
|
||||
screen: modelData
|
||||
color: "transparent"
|
||||
@@ -14,10 +17,46 @@ PanelWindow {
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
mask: Region {}
|
||||
|
||||
readonly property string tz: Cfg.Config.timezone || ""
|
||||
|
||||
property int tzOffsetMin: 0
|
||||
|
||||
property string fullDateString: ""
|
||||
property int typedChars: 0
|
||||
property string secondsString: ""
|
||||
|
||||
onTzOffsetMinChanged: {
|
||||
updateDate(new Date())
|
||||
}
|
||||
|
||||
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
|
||||
+ root.tzOffsetMin * 60000)
|
||||
}
|
||||
|
||||
function startTyping() {
|
||||
typedChars = 0
|
||||
secondsText.opacity = 0
|
||||
@@ -26,13 +65,14 @@ PanelWindow {
|
||||
|
||||
function updateDate(d) {
|
||||
let now = d || new Date()
|
||||
fullDateString = now.toLocaleDateString(Qt.locale(), "dddd, d MMMM yyyy")
|
||||
fullDateString = toTz(now).toLocaleDateString(Qt.locale(),
|
||||
Cfg.Config.dateFormat === "DMY" ? "dddd, d MMMM yyyy" : "dddd, MMMM d, yyyy")
|
||||
startTyping()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
let d = new Date()
|
||||
secondsString = Qt.formatTime(d, "hh:mm:ss")
|
||||
secondsString = Qt.formatTime(toTz(d), "hh:mm:ss")
|
||||
updateDate(d)
|
||||
}
|
||||
|
||||
@@ -50,6 +90,9 @@ PanelWindow {
|
||||
font.letterSpacing: 4
|
||||
opacity: 0.55
|
||||
style: Text.Raised
|
||||
renderType: Text.NativeRendering
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
text: fullDateString.substring(0, typedChars)
|
||||
}
|
||||
|
||||
@@ -63,6 +106,9 @@ PanelWindow {
|
||||
font.letterSpacing: 6
|
||||
opacity: 0
|
||||
style: Text.Raised
|
||||
renderType: Text.NativeRendering
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
text: secondsString
|
||||
|
||||
Behavior on opacity {
|
||||
@@ -94,8 +140,9 @@ PanelWindow {
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
let d = new Date()
|
||||
secondsString = Qt.formatTime(d, "hh:mm:ss")
|
||||
if (d.getSeconds() === 0 && d.getMinutes() === 0 && d.getHours() === 0)
|
||||
let tzd = toTz(d)
|
||||
secondsString = Qt.formatTime(tzd, "hh:mm:ss")
|
||||
if (tzd.getHours() === 0 && tzd.getMinutes() === 0 && tzd.getSeconds() === 0)
|
||||
updateDate(d)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user