Skip to content

Commit 3f70386

Browse files
committed
feat: show/hide panel "AKA toggle panel"
1 parent fe4bf38 commit 3f70386

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

package/contents/ui/code/globals.js

+4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ const baseStockPanelSettings = {
230230
"thickness": {
231231
"enabled": false,
232232
"value": 48
233+
},
234+
"visible": {
235+
"enabled": false,
236+
"value": true
233237
}
234238
}
235239

package/contents/ui/code/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function dumpProps(obj) {
7575
console.error(obj);
7676
for (var k of Object.keys(obj)) {
7777
const val = obj[k]
78-
if (typeof val === 'function') continue
78+
if (k.endsWith("Changed")) continue
7979
if (k === 'metaData') continue
8080
console.log(k + "=" + val + "\n")
8181
}

package/contents/ui/configStockPanelSettings.qml

+26
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,32 @@ KCM.SimpleKCM {
324324
}
325325
enabled: thicknessEnabled.checked
326326
}
327+
328+
Kirigami.Separator {
329+
Kirigami.FormData.isSection: true
330+
Kirigami.FormData.label: i18n("Show/Hide AKA Toggle panel")
331+
}
332+
333+
CheckBox {
334+
Kirigami.FormData.label: i18n("Enabled:")
335+
id: visibleEnabled
336+
checked: config.visible.enabled
337+
onCheckedChanged: {
338+
config.visible.enabled = checked
339+
updateConfig()
340+
}
341+
}
342+
343+
CheckBox {
344+
Kirigami.FormData.label: i18n("Visible:")
345+
id: visible
346+
checked: config.visible.value
347+
onCheckedChanged: {
348+
config.visible.value = checked
349+
updateConfig()
350+
}
351+
enabled: visibleEnabled.checked
352+
}
327353
}
328354
}
329355
}

package/contents/ui/main.qml

+13
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,17 @@ PlasmoidItem {
147147
signal updateMasks()
148148

149149
property var switchPresets: JSON.parse(plasmoid.configuration.switchPresets)
150+
property QtObject panelView: null
150151

151152
onStockPanelSettingsChanged: {
152153
Qt.callLater(function() {
153154
// console.error(JSON.stringify(stockPanelSettings))
154155
let script = Utils.setPanelModeScript(panelPosition, stockPanelSettings)
156+
if (stockPanelSettings.visible.enabled) {
157+
panelView.visible = stockPanelSettings.visible.value
158+
} else {
159+
panelView.visible = true
160+
}
155161
Utils.evaluateScript(script)
156162
})
157163
}
@@ -1285,6 +1291,13 @@ PlasmoidItem {
12851291
}
12861292
}
12871293

1294+
// https://github.com/olib14/pinpanel/blob/2d126f0f3ac3e35a725f05b0060a3dd5c924cbe7/package/contents/ui/main.qml#L58 ♥
1295+
Item {
1296+
onWindowChanged: (window) => {
1297+
main.panelView = window
1298+
}
1299+
}
1300+
12881301
Connections {
12891302
target: plasmoid.configuration
12901303
onValueChanged: {

0 commit comments

Comments
 (0)