Add default fallback city (fixes #199), add beginning of UpdateService

Weather: always fallback to "Tokyo" if the city name is empty
UpdateService: simple versioning control
This commit is contained in:
Ly-sec 2025-09-03 13:37:24 +02:00
parent 7141a91994
commit c6e56d4264
6 changed files with 46 additions and 29 deletions

View file

@ -12,31 +12,9 @@ ColumnLayout {
id: root
property string latestVersion: GitHubService.latestVersion
property string currentVersion: "Unknown" // Fallback version
property string currentVersion: UpdateService.currentVersion
property var contributors: GitHubService.contributors
Process {
id: currentVersionProcess
command: ["sh", "-c", "cd " + Quickshell.shellDir + " && git describe --tags --abbrev=0 2>/dev/null || echo 'Unknown'"]
Component.onCompleted: {
running = true
}
stdout: StdioCollector {
onStreamFinished: {
const version = text.trim()
if (version && version !== "Unknown") {
root.currentVersion = version
} else {
currentVersionProcess.command = ["sh", "-c", "cd " + Quickshell.shellDir
+ " && cat package.json 2>/dev/null | grep '\"version\"' | cut -d'\"' -f4 || echo 'Unknown'"]
currentVersionProcess.running = true
}
}
}
}
NText {
text: "Noctalia Shell"
font.pointSize: Style.fontSizeXXXL * scaling
@ -89,7 +67,7 @@ ColumnLayout {
border.color: Color.mPrimary
border.width: Math.max(1, Style.borderS * scaling)
visible: {
if (root.currentVersion === "Unknown" || root.latestVersion === "Unknown")
if (root.latestVersion === "Unknown")
return false
const latest = root.latestVersion.replace("v", "").split(".")