Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
3.3 KiB
QML
101 lines
3.3 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import "../../components"
|
|
import "../../theme"
|
|
|
|
// Current conditions from wttr.in, refreshed every 30 minutes.
|
|
Face {
|
|
id: root
|
|
readonly property string location: options.location || ""
|
|
readonly property bool fahrenheit: !!options.fahrenheit
|
|
property var current: null
|
|
property string error: ""
|
|
function temperature(celsius) {
|
|
return Math.round(fahrenheit ? celsius * 9 / 5 + 32 : celsius) + "°";
|
|
}
|
|
// WWO weather codes used by wttr.in.
|
|
function glyph(code) {
|
|
if (code === 113)
|
|
return "";
|
|
if (code === 116)
|
|
return "";
|
|
if (code === 119 || code === 122)
|
|
return "";
|
|
if ([143, 248, 260].includes(code))
|
|
return "";
|
|
if ([200, 386, 389, 392, 395].includes(code))
|
|
return "";
|
|
if ([179, 182, 185, 227, 230, 317, 320, 323, 326, 329, 332, 335, 338, 350, 362, 365, 368, 371, 374, 377].includes(code))
|
|
return "";
|
|
return "";
|
|
}
|
|
Process {
|
|
id: fetch
|
|
command: ["python3", Quickshell.shellPath("helpers/weather.py"), root.location]
|
|
stdout: StdioCollector {
|
|
onStreamFinished: {
|
|
try {
|
|
const result = JSON.parse(text);
|
|
if (result.ok) {
|
|
root.current = result;
|
|
root.error = "";
|
|
} else
|
|
root.error = "Weather unavailable";
|
|
} catch (e) {
|
|
root.error = "Weather unavailable";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Timer {
|
|
interval: 30 * 60 * 1000
|
|
running: root.visible
|
|
repeat: true
|
|
triggeredOnStart: true
|
|
onTriggered: if (!fetch.running)
|
|
fetch.running = true
|
|
}
|
|
onLocationChanged: if (!fetch.running)
|
|
fetch.running = true
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.margins: 14
|
|
spacing: 12
|
|
GlassIcon {
|
|
size: Math.min(root.height - 28, 64)
|
|
glyphSize: size * 0.62
|
|
glyph: root.current ? root.glyph(root.current.code) : ""
|
|
fallback: "☁"
|
|
color: Theme.transparent
|
|
border.width: 0
|
|
}
|
|
ColumnLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 0
|
|
Text {
|
|
text: root.current ? root.temperature(root.current.celsius) : "—"
|
|
color: Theme.text
|
|
font.pixelSize: Math.max(20, root.height * 0.3)
|
|
font.weight: Font.Light
|
|
}
|
|
Text {
|
|
text: root.current ? root.current.description : root.error || "Loading…"
|
|
color: Theme.text
|
|
font.pixelSize: 12
|
|
elide: Text.ElideRight
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
visible: !!root.current && root.height > 110
|
|
text: root.current ? root.current.place + " · feels " + root.temperature(root.current.feelsCelsius) : ""
|
|
color: Theme.textSecondary
|
|
font.pixelSize: 10
|
|
elide: Text.ElideRight
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
}
|
|
}
|