Skip to content

Commit 83b2e58

Browse files
committed
fix: floating panel auto-loading condition not working after closing a window
1 parent 2b27bf9 commit 83b2e58

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

package/contents/ui/TasksModel.qml

+13-4
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,26 @@ Item {
6969
filterMinimized: true
7070

7171
onDataChanged: {
72-
if (!updateTimer.running) {
73-
updateTimer.start()
74-
}
72+
Qt.callLater(() => {
73+
if (!updateTimer.running) {
74+
updateTimer.start()
75+
}
76+
})
77+
}
78+
onCountChanged: {
79+
Qt.callLater(() => {
80+
if (!updateTimer.running) {
81+
updateTimer.start()
82+
}
83+
})
7584
}
7685
}
7786

7887
Timer {
7988
id: updateTimer
8089
interval: 5
8190
onTriggered: {
82-
updateWindowsinfo()
91+
root.updateWindowsinfo()
8392
}
8493
}
8594

package/contents/ui/code/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ function getPresetName(panelState, presetAutoloading) {
363363
const priority = ["fullscreenWindow", "maximized", "touchingWindow", "visibleWindows", "floating", "normal"]
364364
for (let state of priority) {
365365
if ((panelState[state] || state === "normal") && presetAutoloading[state]) {
366-
console.error("getPresetName()", state, "->", presetAutoloading[state])
366+
// console.error("getPresetName()", state, "->", presetAutoloading[state])
367367
return presetAutoloading[state]
368368
}
369369
}

package/contents/ui/main.qml

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ PlasmoidItem {
7777
"fullscreenWindow": tasksModel.fullscreenExists,
7878
"maximized": tasksModel.maximizedExists,
7979
"visibleWindows": tasksModel.visibleExists,
80-
"touchingWindow": !panelElement ? false : Boolean(panelElement.touchingWindow),
81-
"floating": !panelElement ? false : Boolean(panelElement.floatingness)
80+
"touchingWindow": panelElement && panelElement.touchingWindow,
81+
"floating": panelElement && panelElement.floatingness > 0
8282
}
8383
property var widgetsDoingBlur: ({})
8484
property var trayItemsDoingBlur: ({})
@@ -1465,8 +1465,8 @@ PlasmoidItem {
14651465
}
14661466

14671467
function switchPreset() {
1468-
let nextPresetDir = Utils.getPresetName(panelState, presetAutoloading)
1469-
if (!nextPresetDir) return
1468+
const nextPresetDir = Utils.getPresetName(panelState, presetAutoloading)
1469+
if (nextPresetDir && nextPresetDir !== lastPreset)
14701470
applyPreset(nextPresetDir)
14711471
}
14721472

0 commit comments

Comments
 (0)