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
sourceComponent: Bar {
screen: modelData
visible: !Hyprland.monitorFor(modelData).activeWorkspace.hasFullscreen
visible: !Hyprland.monitorFor(modelData).activeWorkspace?.hasFullscreen
} // creates instance of bar component
}
}
+3 -1
View File
@@ -183,6 +183,8 @@ Item {
"lightburn": "󱇣",
"wofi": "",
// Screenshare
"moonlight": "󰍹ßß"
"moonlight": "󰍹",
// PCB
"kicad": "",
})
}
+17 -8
View File
@@ -51,10 +51,19 @@ Item {
// ---- persistence: survives reload AND close (FileView -> disk) ----
// 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"
// 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 {
id: historyFile
path: _historyPath
printErrors: true
printErrors: false
// adapter holds json, synced to disk via writeAdapter()
adapter: JsonAdapter {
property var percentageHistory: []
@@ -85,6 +94,7 @@ Item {
repeat: true
running: true
onTriggered: {
if (historyFile.path === "") historyFile.path = root._historyPath
historyFile.adapter.percentageHistory = root.percentageHistory
historyFile.adapter.energyHistory = root.energyHistory
historyFile.adapter.usageHistory = root.usageHistory
@@ -125,11 +135,10 @@ Item {
// ensure save on clean close / reload (best-effort, reload preserves via FileView anyway)
Component.onDestruction: {
if (historyFile.loaded) {
historyFile.adapter.percentageHistory = root.percentageHistory
historyFile.adapter.energyHistory = root.energyHistory
historyFile.adapter.usageHistory = root.usageHistory
historyFile.writeAdapter()
}
if (historyFile.path === "") historyFile.path = root._historyPath
historyFile.adapter.percentageHistory = root.percentageHistory
historyFile.adapter.energyHistory = root.energyHistory
historyFile.adapter.usageHistory = root.usageHistory
historyFile.writeAdapter()
}
}
+19 -12
View File
@@ -42,10 +42,17 @@ QtObject {
// ---- persistence: survives reload AND close (disk) ----
// 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"
// 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
property FileView historyFile: FileView {
path: _historyPath
printErrors: true
printErrors: false
adapter: JsonAdapter {
property var downloadHistory: []
property var uploadHistory: []
@@ -73,19 +80,19 @@ QtObject {
repeat: true
running: true
onTriggered: {
historyFile.adapter.downloadHistory = root.downloadHistory
historyFile.adapter.uploadHistory = root.uploadHistory
historyFile.adapter.pingHistory = root.pingHistory
historyFile.writeAdapter()
if (root.historyFile.path === "") root.historyFile.path = root._historyPath
root.historyFile.adapter.downloadHistory = root.downloadHistory
root.historyFile.adapter.uploadHistory = root.uploadHistory
root.historyFile.adapter.pingHistory = root.pingHistory
root.historyFile.writeAdapter()
}
}
Component.onDestruction: {
if (historyFile.loaded) {
historyFile.adapter.downloadHistory = root.downloadHistory
historyFile.adapter.uploadHistory = root.uploadHistory
historyFile.adapter.pingHistory = root.pingHistory
historyFile.writeAdapter()
}
if (root.historyFile.path === "") root.historyFile.path = root._historyPath
root.historyFile.adapter.downloadHistory = root.downloadHistory
root.historyFile.adapter.uploadHistory = root.uploadHistory
root.historyFile.adapter.pingHistory = root.pingHistory
root.historyFile.writeAdapter()
}
function findAllConnectedDevices() {
+6 -6
View File
@@ -94,8 +94,8 @@ Rectangle {
height: Math.max(iconRectangle.height, contentRectangle.height)+contentRow.anchors.margins*2
width: parent.width
color: "transparent"
border.width: Config.border_width
border.color: textColor
// border.width: Config.border_width
// border.color: textColor
MouseArea {
id: closingMouseArea
@@ -251,8 +251,8 @@ Rectangle {
id: actionRowRectangle
width: root.width
height: Config.screen_height_to_font_tiny(screen.height)+2*Config.spacing
border.width: Config.border_width
border.color: textColor
// border.width: Config.border_width
// border.color: textColor
color: "transparent"
visible: notification.actions.length > 0
Row{
@@ -336,8 +336,8 @@ Rectangle {
id: inlineReplyRectangle
width: root.width
height: Config.screen_height_to_font_small(screen.height)+2*Config.spacing
border.width: Config.border_width
border.color: textColor
// border.width: Config.border_width
// border.color: textColor
color: "transparent"
visible: notification.hasInlineReply