Skip to content

Commit adb3219

Browse files
committed
fix: widget not hiding (main)
fixes 1117784
1 parent c699660 commit adb3219

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

package/contents/ui/main.qml

+36-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ PlasmoidItem {
2525
property int panelLayoutCount: panelLayout?.children?.length || 0
2626
property int trayGridViewCount: trayGridView?.count || 0
2727
property int trayGridViewCountOld: 0
28+
property var panelPosition: {
29+
var location
30+
var screen = main.screen
31+
switch (plasmoid.location) {
32+
case PlasmaCore.Types.TopEdge:
33+
location = "top"
34+
break
35+
case PlasmaCore.Types.BottomEdge:
36+
location = "bottom"
37+
break
38+
case PlasmaCore.Types.LeftEdge:
39+
location = "left"
40+
break
41+
case PlasmaCore.Types.RightEdge:
42+
location = "right"
43+
break
44+
}
45+
return { screen, location }
46+
}
2847
property bool horizontal: Plasmoid.formFactor === PlasmaCore.Types.Horizontal
2948
property bool editMode: Plasmoid.containment.corona?.editMode ?? false
3049
property bool onDesktop: plasmoid.location === PlasmaCore.Types.Floating
@@ -1471,6 +1490,7 @@ PlasmoidItem {
14711490
onTriggered: {
14721491
Plasmoid.activated()
14731492
main.expanded = false
1493+
bindPlasmoidStatusTimer.restart()
14741494
}
14751495
}
14761496

@@ -1485,13 +1505,16 @@ PlasmoidItem {
14851505
// X11 doesn't seem to need it and also would flicker the panel/screen
14861506
dbusKWinReconfigure.call()
14871507
}
1488-
if (["autohide", "dodgewindows"].includes(stockPanelSettings.visibility.value)) {
1508+
1509+
Plasmoid.status = hideWidget ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus
1510+
if (["autohide", "dodgewindows"].includes(stockPanelSettings.visibility.value) && panelPosition.location !== stockPanelSettings.position.value) {
14891511
// activate the panel for a longer time if it can hide
14901512
// to avoid plasma crash when changing its location
14911513
tempActivationTimer.restart()
14921514
} else {
14931515
Plasmoid.activated()
14941516
Plasmoid.activated()
1517+
bindPlasmoidStatus()
14951518
}
14961519
}
14971520

@@ -1593,6 +1616,7 @@ PlasmoidItem {
15931616
}
15941617

15951618
Component.onCompleted: {
1619+
bindPlasmoidStatus()
15961620
Qt.callLater(function() {
15971621
const config = Utils.mergeConfigs(Globals.defaultConfig, cfg)
15981622
plasmoid.configuration.globalSettings = Utils.stringify(config)
@@ -1684,9 +1708,17 @@ PlasmoidItem {
16841708
}
16851709
toolTipTextFormat: Text.PlainText
16861710

1687-
Plasmoid.status: (editMode || !hideWidget) ?
1688-
PlasmaCore.Types.ActiveStatus :
1689-
PlasmaCore.Types.HiddenStatus
1711+
function bindPlasmoidStatus() {
1712+
Plasmoid.status = Qt.binding(function () {return (editMode || !hideWidget) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus})
1713+
}
1714+
1715+
Timer {
1716+
id: bindPlasmoidStatusTimer
1717+
interval: 600
1718+
onTriggered: {
1719+
bindPlasmoidStatus()
1720+
}
1721+
}
16901722

16911723
Plasmoid.contextualActions: [
16921724
PlasmaCore.Action {

0 commit comments

Comments
 (0)