Skip to content

Commit

Permalink
feat: show/hide panel "AKA toggle panel"
Browse files Browse the repository at this point in the history
  • Loading branch information
luisbocanegra committed Jan 18, 2025
1 parent fe4bf38 commit 3f70386
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
4 changes: 4 additions & 0 deletions package/contents/ui/code/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ const baseStockPanelSettings = {
"thickness": {
"enabled": false,
"value": 48
},
"visible": {
"enabled": false,
"value": true
}
}

Expand Down
2 changes: 1 addition & 1 deletion package/contents/ui/code/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function dumpProps(obj) {
console.error(obj);
for (var k of Object.keys(obj)) {
const val = obj[k]
if (typeof val === 'function') continue
if (k.endsWith("Changed")) continue
if (k === 'metaData') continue
console.log(k + "=" + val + "\n")
}
Expand Down
26 changes: 26 additions & 0 deletions package/contents/ui/configStockPanelSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,32 @@ KCM.SimpleKCM {
}
enabled: thicknessEnabled.checked
}

Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Show/Hide AKA Toggle panel")
}

CheckBox {
Kirigami.FormData.label: i18n("Enabled:")
id: visibleEnabled
checked: config.visible.enabled
onCheckedChanged: {
config.visible.enabled = checked
updateConfig()
}
}

CheckBox {
Kirigami.FormData.label: i18n("Visible:")
id: visible
checked: config.visible.value
onCheckedChanged: {
config.visible.value = checked
updateConfig()
}
enabled: visibleEnabled.checked
}
}
}
}
13 changes: 13 additions & 0 deletions package/contents/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,17 @@ PlasmoidItem {
signal updateMasks()

property var switchPresets: JSON.parse(plasmoid.configuration.switchPresets)
property QtObject panelView: null

onStockPanelSettingsChanged: {
Qt.callLater(function() {
// console.error(JSON.stringify(stockPanelSettings))
let script = Utils.setPanelModeScript(panelPosition, stockPanelSettings)
if (stockPanelSettings.visible.enabled) {
panelView.visible = stockPanelSettings.visible.value
} else {
panelView.visible = true
}
Utils.evaluateScript(script)
})
}
Expand Down Expand Up @@ -1285,6 +1291,13 @@ PlasmoidItem {
}
}

// https://github.com/olib14/pinpanel/blob/2d126f0f3ac3e35a725f05b0060a3dd5c924cbe7/package/contents/ui/main.qml#L58 ♥
Item {
onWindowChanged: (window) => {
main.panelView = window
}
}

Connections {
target: plasmoid.configuration
onValueChanged: {
Expand Down

0 comments on commit 3f70386

Please sign in to comment.