Skip to content

Commit 342fa50

Browse files
committed
fix: update windows geometry on config changes
There must be another way to do this but org.kde.KWin.reconfigure seems to work for now
1 parent 69827e7 commit 342fa50

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

package/contents/ui/code/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ var themeScopes = [
213213
]
214214

215215
function getWidgetAsocIdx(id, name, config) {
216-
console.log("getWidgetAsocIdx()")
216+
// console.log("getWidgetAsocIdx()")
217217
return config.findIndex((item) => item.id == id && item.name == name)
218218
}
219219

package/contents/ui/main.qml

+26-7
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,23 @@ PlasmoidItem {
12771277
}
12781278
}
12791279

1280+
Timer {
1281+
id: reconfigureTimer
1282+
interval: 10
1283+
onTriggered: {
1284+
runCommand.run("gdbus call --session --dest org.kde.KWin --object-path /KWin --method org.kde.KWin.reconfigure")
1285+
}
1286+
}
1287+
1288+
Connections {
1289+
target: plasmoid.configuration
1290+
onValueChanged: {
1291+
Qt.callLater(function () {
1292+
reconfigureTimer.restart()
1293+
})
1294+
}
1295+
}
1296+
12801297
function updateCurrentWidgets() {
12811298
panelWidgets = []
12821299
panelWidgets = Utils.findWidgets(panelLayout, panelWidgets)
@@ -1394,14 +1411,16 @@ PlasmoidItem {
13941411
target: runCommand
13951412
function onExited(cmd, exitCode, exitStatus, stdout, stderr, liveUpdate) {
13961413
if (exitCode!==0) return
1397-
try {
1398-
presetContent = JSON.parse(stdout.trim())
1399-
} catch (e) {
1400-
return
1414+
if (cmd.startsWith("cat")) {
1415+
try {
1416+
presetContent = JSON.parse(stdout.trim())
1417+
} catch (e) {
1418+
return
1419+
}
1420+
Utils.loadPreset(presetContent, plasmoid.configuration, Globals.ignoredConfigs, Globals.defaultConfig, true)
1421+
plasmoid.configuration.lastPreset = lastPreset
1422+
plasmoid.configuration.writeConfig();
14011423
}
1402-
Utils.loadPreset(presetContent, plasmoid.configuration, Globals.ignoredConfigs, Globals.defaultConfig, true)
1403-
plasmoid.configuration.lastPreset = lastPreset
1404-
plasmoid.configuration.writeConfig();
14051424
}
14061425
}
14071426

0 commit comments

Comments
 (0)