Skip to content

Commit 56c2a4a

Browse files
committed
fix: X11 screen flicker and window resizing with panel
- dont use org.kde.KWin.reconfigure on X11 to avoid flicker, also doesn't seem to need it - add a workaround to crash on panel location change by temporarily showing the panel, also seems to fix the activation zone being stuck at the previous screen edge refs: #160
1 parent 7cf87cb commit 56c2a4a

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

package/contents/ui/main.qml

+31-13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ PlasmoidItem {
2828
property bool horizontal: Plasmoid.formFactor === PlasmaCore.Types.Horizontal
2929
property bool editMode: Plasmoid.containment.corona?.editMode ?? false
3030
property bool onDesktop: plasmoid.location === PlasmaCore.Types.Floating
31+
property bool isWayland: Qt.platform.pluginName.includes("wayland")
3132
property string iconName: !onDesktop ? "icon" : "error"
3233
property string icon: Qt.resolvedUrl("../icons/" + iconName + ".svg").toString().replace("file://", "")
3334
property bool hideWidget: plasmoid.configuration.hideWidget
@@ -145,6 +146,7 @@ PlasmoidItem {
145146
panelView.visible = true
146147
}
147148
Utils.evaluateScript(script)
149+
reconfigure()
148150
})
149151
}
150152

@@ -1357,16 +1359,17 @@ PlasmoidItem {
13571359

13581360
onPanelLayoutChanged: {
13591361
if (!panelLayout) return
1360-
panelFixTimer.start()
1362+
panelFixTimer.restart()
13611363
}
13621364

13631365
Timer {
13641366
id: panelFixTimer
13651367
repeat: false
1366-
interval: 1000
1368+
interval: 2000
13671369
onTriggered: {
13681370
doPanelLengthFix = true
13691371
doPanelLengthFix = false
1372+
reconfigure()
13701373
}
13711374
}
13721375

@@ -1446,12 +1449,36 @@ PlasmoidItem {
14461449
inSignature: null
14471450
}
14481451

1452+
// temporarily show the panel
14491453
Timer {
1450-
id: reconfigureTimer
1451-
interval: 10
1454+
id: tempActivationTimer
1455+
interval: 500
1456+
triggeredOnStart: true
14521457
onTriggered: {
1458+
Plasmoid.activated()
1459+
main.expanded = false
1460+
}
1461+
}
1462+
1463+
function reconfigure() {
1464+
// sometimes windows won't update when the panel visibility or height
1465+
// (and maybe other properties) changes, this is more noticeable with
1466+
// krohnkite tiling extension so we make the panel visible by
1467+
// activating the widget for a moment which in turn activates the panel
1468+
// and org.kde.KWin.reconfigure triggers the resize we need
1469+
// TODO figure out how the desktop edit mode informs the new available size
1470+
if (isWayland) {
1471+
// X11 doesn't seem to need it and also would flicker the panel/screen
14531472
dbusKWinReconfigure.call()
14541473
}
1474+
if (["autohide", "dodgewindows"].includes(stockPanelSettings.visibility.value)) {
1475+
// activate the panel for a longer time if it can hide
1476+
// to avoid plasma crash when changing its location
1477+
tempActivationTimer.restart()
1478+
} else {
1479+
Plasmoid.activated()
1480+
Plasmoid.activated()
1481+
}
14551482
}
14561483

14571484
// https://github.com/olib14/pinpanel/blob/2d126f0f3ac3e35a725f05b0060a3dd5c924cbe7/package/contents/ui/main.qml#L58 ♥
@@ -1461,15 +1488,6 @@ PlasmoidItem {
14611488
}
14621489
}
14631490

1464-
Connections {
1465-
target: plasmoid.configuration
1466-
onValueChanged: {
1467-
Qt.callLater(function () {
1468-
reconfigureTimer.restart()
1469-
})
1470-
}
1471-
}
1472-
14731491
function updateCurrentWidgets() {
14741492
panelWidgets = []
14751493
panelWidgets = Utils.findWidgets(panelLayout, panelWidgets)

0 commit comments

Comments
 (0)