Skip to content

Commit 58b2196

Browse files
committed
fix!: require allowing floating applets changes 6.4.0 and later
Since version 6.4.0, Plasma now has a built-in Floating panel and applets option, we are overriding it since older versions blocking the user from changing it manually. Now the user has to explicitly allow changing it so we don't alter it by default refs: #293 BREAKING CHANGE: If you are forcing floating dialogs (applets) you will need to update your settings/presets to allow floating applets changes in plasma 6.4.0 and later **Appearance** > **Floating applets** > enable (check) allow changes
1 parent 0c097bc commit 58b2196

38 files changed

Lines changed: 121 additions & 36 deletions

File tree

package/contents/ui/code/globals.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ const defaultConfig = {
304304
shadow: true,
305305
},
306306
floatingDialogs: false,
307+
floatingDialogsAllowOverride: false,
307308
},
308309
stockPanelSettings: baseStockPanelSettings,
309310
configurationOverrides: {

package/contents/ui/components/FormWidgetSettings.qml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import org.kde.kirigami as Kirigami
55
import org.kde.plasma.plasmoid
66
import "../code/enum.js" as Enum
77
import "../code/utils.js" as Utils
8+
import "../code/version.js" as VersionUtil
9+
import ".."
810

911
ColumnLayout {
1012
id: root
@@ -73,6 +75,23 @@ ColumnLayout {
7375
}
7476
}
7577

78+
property var plasmaVersion: new VersionUtil.Version("999.999.999") // to assume latest
79+
RunCommand {
80+
id: runCommand
81+
onExited: (cmd, exitCode, exitStatus, stdout, stderr) => {
82+
if (exitCode !== 0) {
83+
console.error(cmd, exitCode, exitStatus, stdout, stderr);
84+
return;
85+
}
86+
if (stdout) {
87+
const parts = stdout.split(" ");
88+
if (parts.length < 2)
89+
return;
90+
root.plasmaVersion = new VersionUtil.Version(parts[1]);
91+
}
92+
}
93+
}
94+
7695
signal updateConfigString(string configString, var config)
7796
signal tabChanged(int currentTab)
7897

@@ -92,6 +111,7 @@ ColumnLayout {
92111
}
93112
Component.onCompleted: {
94113
Utils.delay(50, () => ready = true, root);
114+
runCommand.run('plasmashell --version');
95115
}
96116

97117
Kirigami.FormLayout {
@@ -217,14 +237,33 @@ ColumnLayout {
217237
}
218238
}
219239

240+
RowLayout {
241+
Kirigami.FormData.label: i18n("Floating applets:")
242+
CheckBox {
243+
id: floatingDialogsEnabledCheckbox
244+
visible: elementName === "panel" && root.elementState === Enum.WidgetStates.Normal
245+
text: i18n("Allow changes (Plasma 6.4.0 and later)")
246+
checked: config.nativePanel.floatingDialogsAllowOverride
247+
onCheckedChanged: {
248+
config.nativePanel.floatingDialogsAllowOverride = checked;
249+
updateConfig();
250+
}
251+
}
252+
Kirigami.ContextualHelpButton {
253+
toolTipText: i18n("Since version 6.4.0, Plasma now has a built-in <b>Floating panel and applets</b> option, enabling this overrides that option.\n⚠️Changing <b>Floating</b> from the panel configuration will not work with this is enabled!")
254+
}
255+
visible: root.plasmaVersion.isGreaterThan("6.3.5")
256+
}
257+
220258
CheckBox {
221259
visible: elementName === "panel" && root.elementState === Enum.WidgetStates.Normal
222-
text: i18n("Force floating dialogs")
260+
text: i18n("Force floating applets")
223261
checked: config.nativePanel.floatingDialogs
224262
onCheckedChanged: {
225263
config.nativePanel.floatingDialogs = checked;
226264
updateConfig();
227265
}
266+
enabled: floatingDialogsEnabledCheckbox.checked || root.plasmaVersion.isLowerThan("6.4.0")
228267
}
229268

230269
CheckBox {

package/contents/ui/main.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ PlasmoidItem {
5454
property bool hideWidget: plasmoid.configuration.hideWidget
5555
property bool fixedSidePaddingEnabled: isEnabled && panelBgItem.cfg.padding.enabled
5656
property bool floatingDialogs: main.isEnabled ? cfg.nativePanel.floatingDialogs : false
57+
property bool floatingDialogsAllowOverride: main.isEnabled ? cfg.nativePanel.floatingDialogsAllowOverride : false
5758
property bool isEnabled: plasmoid.configuration.isEnabled
5859
property bool nativePanelBackgroundEnabled: (isEnabled ? cfg.nativePanel.background.enabled : true) || doPanelClickFix
5960
property real nativePanelBackgroundOpacity: isEnabled ? cfg.nativePanel.background.opacity : 1.0
@@ -1473,10 +1474,19 @@ PlasmoidItem {
14731474
setFloatigApplets();
14741475
}
14751476

1477+
onFloatingDialogsAllowOverrideChanged: {
1478+
setFloatigApplets();
1479+
}
1480+
14761481
// inspired by https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1912
14771482
function setFloatigApplets() {
14781483
if (!containmentItem)
14791484
return;
1485+
// Plasma 6.4 now has a floating applets option, but we are overriding it,
1486+
// so let's require the user to enable it before forcing one state of the other
1487+
if (main.plasmaVersion.isGreaterThan("6.3.5") && !floatingDialogsAllowOverride) {
1488+
return;
1489+
}
14801490
if (floatingDialogs) {
14811491
containmentItem.Plasmoid.containmentDisplayHints |= PlasmaCore.Types.ContainmentPrefersFloatingApplets;
14821492
} else {

package/contents/ui/presets/Black Color Lines/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@
668668
"opacity": 1,
669669
"shadow": true
670670
},
671-
"floatingDialogs": false
671+
"floatingDialogs": false,
672+
"floatingDialogsAllowOverride": false
672673
}
673674
}
674675
}

package/contents/ui/presets/Black Gray Lines/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@
668668
"opacity": 1,
669669
"shadow": true
670670
},
671-
"floatingDialogs": false
671+
"floatingDialogs": false,
672+
"floatingDialogsAllowOverride": false
672673
}
673674
}
674675
}

package/contents/ui/presets/Black/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,8 @@
667667
"opacity": 1,
668668
"shadow": true
669669
},
670-
"floatingDialogs": false
670+
"floatingDialogs": false,
671+
"floatingDialogsAllowOverride": false
671672
}
672673
}
673674
}

package/contents/ui/presets/Bliss Light/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,8 @@
918918
"opacity": 0,
919919
"shadow": false
920920
},
921-
"floatingDialogs": true
921+
"floatingDialogs": true,
922+
"floatingDialogsAllowOverride": true
922923
}
923924
}
924925
}

package/contents/ui/presets/Bliss/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,8 @@
918918
"opacity": 0,
919919
"shadow": false
920920
},
921-
"floatingDialogs": true
921+
"floatingDialogs": true,
922+
"floatingDialogsAllowOverride": true
922923
}
923924
}
924925
}

package/contents/ui/presets/Blur Widgets 2/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@
933933
"opacity": 0,
934934
"shadow": false
935935
},
936-
"floatingDialogs": true
936+
"floatingDialogs": true,
937+
"floatingDialogsAllowOverride": true
937938
}
938939
}
939940
}

package/contents/ui/presets/Blur Widgets/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,8 @@
918918
"opacity": 0,
919919
"shadow": false
920920
},
921-
"floatingDialogs": true
921+
"floatingDialogs": true,
922+
"floatingDialogsAllowOverride": true
922923
}
923924
}
924925
}

0 commit comments

Comments
 (0)