1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 15:32:50 -05:00

dankbar: add swap option to dankbar

fixes #556
This commit is contained in:
bbedward
2025-11-04 22:59:47 -05:00
parent 315509f7a4
commit 8d7db49cb0
4 changed files with 131 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ Column {
signal diskMountSelectionChanged(string sectionId, int widgetIndex, string mountPath)
signal controlCenterSettingChanged(string sectionId, int widgetIndex, string settingName, bool value)
signal minimumWidthChanged(string sectionId, int widgetIndex, bool enabled)
signal showSwapChanged(string sectionId, int widgetIndex, bool enabled)
width: parent.width
height: implicitHeight
@@ -315,6 +316,34 @@ Column {
}
}
DankActionButton {
id: showSwapButton
buttonSize: 28
visible: modelData.id === "memUsage"
iconName: "swap_horiz"
iconSize: 16
iconColor: (modelData.showSwap !== undefined ? modelData.showSwap : false) ? Theme.primary : Theme.outline
onClicked: {
var currentEnabled = modelData.showSwap !== undefined ? modelData.showSwap : false
root.showSwapChanged(root.sectionId, index, !currentEnabled)
}
onEntered: {
showSwapTooltipLoader.active = true
if (showSwapTooltipLoader.item) {
var currentEnabled = modelData.showSwap !== undefined ? modelData.showSwap : false
const tooltipText = currentEnabled ? "Hide Swap" : "Show Swap"
const p = showSwapButton.mapToItem(null, showSwapButton.width / 2, 0)
showSwapTooltipLoader.item.show(tooltipText, p.x, p.y - 40, null)
}
}
onExited: {
if (showSwapTooltipLoader.item) {
showSwapTooltipLoader.item.hide()
}
showSwapTooltipLoader.active = false
}
}
Row {
spacing: Theme.spacingXS
visible: modelData.id === "clock"
@@ -974,4 +1003,10 @@ Column {
active: false
sourceComponent: DankTooltip {}
}
Loader {
id: showSwapTooltipLoader
active: false
sourceComponent: DankTooltip {}
}
}