Compare commits

...
4 Commits
5 changed files with 46 additions and 28 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ Item {
active: true // loads object active: true // loads object
sourceComponent: Bar { sourceComponent: Bar {
screen: modelData screen: modelData
visible: !Hyprland.monitorFor(modelData).activeWorkspace.hasFullscreen visible: !Hyprland.monitorFor(modelData).activeWorkspace?.hasFullscreen
} // creates instance of bar component } // creates instance of bar component
} }
} }
+3 -1
View File
@@ -183,6 +183,8 @@ Item {
"lightburn": "󱇣", "lightburn": "󱇣",
"wofi": "", "wofi": "",
// Screenshare // Screenshare
"moonlight": "󰍹ßß" "moonlight": "󰍹",
// PCB
"kicad": "",
}) })
} }
+17 -8
View File
@@ -51,10 +51,19 @@ Item {
// ---- persistence: survives reload AND close (FileView -> disk) ---- // ---- persistence: survives reload AND close (FileView -> disk) ----
// use Config.configDir (base dir) so path is stable and visible in repo // use Config.configDir (base dir) so path is stable and visible in repo
readonly property string _historyPath: Config.configDir + "/modules/bar/states/Battery/battery_history.json" readonly property string _historyPath: Config.configDir + "/modules/bar/states/Battery/battery_history.json"
// guard: don't try to read non-existent file (avoids FileView warning)
Process {
id: historyFileExistsCheck
command: ["test", "-f", root._historyPath]
onExited: function(exitCode, exitStatus) {
if (exitCode === 0) historyFile.path = root._historyPath
// else keep historyFile.path empty -> no read attempt, writes will set it later
}
Component.onCompleted: running = true
}
FileView { FileView {
id: historyFile id: historyFile
path: _historyPath printErrors: false
printErrors: true
// adapter holds json, synced to disk via writeAdapter() // adapter holds json, synced to disk via writeAdapter()
adapter: JsonAdapter { adapter: JsonAdapter {
property var percentageHistory: [] property var percentageHistory: []
@@ -85,6 +94,7 @@ Item {
repeat: true repeat: true
running: true running: true
onTriggered: { onTriggered: {
if (historyFile.path === "") historyFile.path = root._historyPath
historyFile.adapter.percentageHistory = root.percentageHistory historyFile.adapter.percentageHistory = root.percentageHistory
historyFile.adapter.energyHistory = root.energyHistory historyFile.adapter.energyHistory = root.energyHistory
historyFile.adapter.usageHistory = root.usageHistory historyFile.adapter.usageHistory = root.usageHistory
@@ -125,11 +135,10 @@ Item {
// ensure save on clean close / reload (best-effort, reload preserves via FileView anyway) // ensure save on clean close / reload (best-effort, reload preserves via FileView anyway)
Component.onDestruction: { Component.onDestruction: {
if (historyFile.loaded) { if (historyFile.path === "") historyFile.path = root._historyPath
historyFile.adapter.percentageHistory = root.percentageHistory historyFile.adapter.percentageHistory = root.percentageHistory
historyFile.adapter.energyHistory = root.energyHistory historyFile.adapter.energyHistory = root.energyHistory
historyFile.adapter.usageHistory = root.usageHistory historyFile.adapter.usageHistory = root.usageHistory
historyFile.writeAdapter() historyFile.writeAdapter()
}
} }
} }
+19 -12
View File
@@ -42,10 +42,17 @@ QtObject {
// ---- persistence: survives reload AND close (disk) ---- // ---- persistence: survives reload AND close (disk) ----
// use Config.configDir (base dir) so path is stable and visible in repo // use Config.configDir (base dir) so path is stable and visible in repo
readonly property string _historyPath: Config.configDir + "/modules/bar/states/Network/network_history.json" readonly property string _historyPath: Config.configDir + "/modules/bar/states/Network/network_history.json"
// guard: don't try to read non-existent file
property Process historyFileExistsCheck: Process {
command: ["test", "-f", root._historyPath]
onExited: function(exitCode, exitStatus) {
if (exitCode === 0) root.historyFile.path = root._historyPath
}
Component.onCompleted: running = true
}
// QtObject has no default property, so hold FileView as typed property // QtObject has no default property, so hold FileView as typed property
property FileView historyFile: FileView { property FileView historyFile: FileView {
path: _historyPath printErrors: false
printErrors: true
adapter: JsonAdapter { adapter: JsonAdapter {
property var downloadHistory: [] property var downloadHistory: []
property var uploadHistory: [] property var uploadHistory: []
@@ -73,19 +80,19 @@ QtObject {
repeat: true repeat: true
running: true running: true
onTriggered: { onTriggered: {
historyFile.adapter.downloadHistory = root.downloadHistory if (root.historyFile.path === "") root.historyFile.path = root._historyPath
historyFile.adapter.uploadHistory = root.uploadHistory root.historyFile.adapter.downloadHistory = root.downloadHistory
historyFile.adapter.pingHistory = root.pingHistory root.historyFile.adapter.uploadHistory = root.uploadHistory
historyFile.writeAdapter() root.historyFile.adapter.pingHistory = root.pingHistory
root.historyFile.writeAdapter()
} }
} }
Component.onDestruction: { Component.onDestruction: {
if (historyFile.loaded) { if (root.historyFile.path === "") root.historyFile.path = root._historyPath
historyFile.adapter.downloadHistory = root.downloadHistory root.historyFile.adapter.downloadHistory = root.downloadHistory
historyFile.adapter.uploadHistory = root.uploadHistory root.historyFile.adapter.uploadHistory = root.uploadHistory
historyFile.adapter.pingHistory = root.pingHistory root.historyFile.adapter.pingHistory = root.pingHistory
historyFile.writeAdapter() root.historyFile.writeAdapter()
}
} }
function findAllConnectedDevices() { function findAllConnectedDevices() {
+6 -6
View File
@@ -94,8 +94,8 @@ Rectangle {
height: Math.max(iconRectangle.height, contentRectangle.height)+contentRow.anchors.margins*2 height: Math.max(iconRectangle.height, contentRectangle.height)+contentRow.anchors.margins*2
width: parent.width width: parent.width
color: "transparent" color: "transparent"
border.width: Config.border_width // border.width: Config.border_width
border.color: textColor // border.color: textColor
MouseArea { MouseArea {
id: closingMouseArea id: closingMouseArea
@@ -251,8 +251,8 @@ Rectangle {
id: actionRowRectangle id: actionRowRectangle
width: root.width width: root.width
height: Config.screen_height_to_font_tiny(screen.height)+2*Config.spacing height: Config.screen_height_to_font_tiny(screen.height)+2*Config.spacing
border.width: Config.border_width // border.width: Config.border_width
border.color: textColor // border.color: textColor
color: "transparent" color: "transparent"
visible: notification.actions.length > 0 visible: notification.actions.length > 0
Row{ Row{
@@ -336,8 +336,8 @@ Rectangle {
id: inlineReplyRectangle id: inlineReplyRectangle
width: root.width width: root.width
height: Config.screen_height_to_font_small(screen.height)+2*Config.spacing height: Config.screen_height_to_font_small(screen.height)+2*Config.spacing
border.width: Config.border_width // border.width: Config.border_width
border.color: textColor // border.color: textColor
color: "transparent" color: "transparent"
visible: notification.hasInlineReply visible: notification.hasInlineReply