Skip to content

Commit 6f435ae

Browse files
committed
feat: option to force always floating dialogs
1 parent 51ddc8d commit 6f435ae

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

package/contents/ui/code/globals.js

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ const basePanelConfig = {
164164
"padding": basePadding,
165165
"border": baseBorder,
166166
"shadow": baseShadowConfig,
167+
"floatingDialogs": false
167168
}
168169

169170
const baseWidgetConfig = {

package/contents/ui/components/FormWidgetSettings.qml

+13-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ ColumnLayout {
134134
checked: configLocal.blurBehind
135135
onCheckedChanged: {
136136
configLocal.blurBehind = checked
137-
if (checked) {
138-
}
139137
updateConfig()
140138
}
141139
enabled: isEnabled.checked
@@ -160,6 +158,19 @@ ColumnLayout {
160158
}
161159
]
162160
}
161+
RowLayout {
162+
Label {
163+
text: i18n("Force floating dialogs:")
164+
}
165+
CheckBox {
166+
checked: configLocal.floatingDialogs
167+
onCheckedChanged: {
168+
configLocal.floatingDialogs = checked
169+
updateConfig()
170+
}
171+
enabled: isEnabled.checked
172+
}
173+
}
163174
}
164175
}
165176

package/contents/ui/main.qml

+22
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ PlasmoidItem {
5050
property string icon: Qt.resolvedUrl("../icons/" + iconName + ".svg").toString().replace("file://", "")
5151
property bool hideWidget: plasmoid.configuration.hideWidget
5252
property bool fixedSidePaddingEnabled: isEnabled && panelSettings.padding.enabled
53+
property bool floatingDialogs: panelSettings.floatingDialogs
5354
property bool isEnabled: plasmoid.configuration.isEnabled
5455
property bool nativePanelBackgroundEnabled: (isEnabled ? cfg.nativePanelBackground.enabled : true) || doPanelClickFix
5556
property real nativePanelBackgroundOpacity: isEnabled ? cfg.nativePanelBackground.opacity : 1.0
@@ -1189,9 +1190,30 @@ PlasmoidItem {
11891190
Utils.panelOpacity(panelElement, isEnabled, nativePanelBackgroundOpacity)
11901191
}
11911192

1193+
onFloatingDialogsChanged: {
1194+
setFloatigApplets()
1195+
}
1196+
1197+
// inspired by https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1912
1198+
function setFloatigApplets() {
1199+
if (floatingDialogs) {
1200+
containmentItem.Plasmoid.containmentDisplayHints |= PlasmaCore.Types.ContainmentPrefersFloatingApplets
1201+
} else {
1202+
containmentItem.Plasmoid.containmentDisplayHints &= ~PlasmaCore.Types.ContainmentPrefersFloatingApplets
1203+
}
1204+
}
1205+
1206+
Connections {
1207+
target: containmentItem.Plasmoid
1208+
onContainmentDisplayHintsChanged: {
1209+
setFloatigApplets()
1210+
}
1211+
}
1212+
11921213
onContainmentItemChanged: {
11931214
if(!containmentItem) return
11941215
Utils.toggleTransparency(containmentItem, nativePanelBackgroundEnabled)
1216+
setFloatigApplets()
11951217
}
11961218

11971219
// HACK: change panelLayout spacing on startup to trigger a length reload

0 commit comments

Comments
 (0)