1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

Media volume scroll on DankBar widget and media volume OSD (#795)

* osd: add media volume OSD

* media: scroll on widget changes media volume

* dash: use media volume in media tab
This commit is contained in:
Lucas
2025-11-23 02:42:06 -03:00
committed by GitHub
parent 89298fce30
commit 6cc6e7c8e9
8 changed files with 376 additions and 35 deletions

View File

@@ -39,6 +39,33 @@ BasePill {
return audioVizHeight + Theme.spacingXS + playButtonHeight;
}
onWheel: function (wheelEvent) {
if (!activePlayer) {
wheelEvent.accepted = false;
return;
}
wheelEvent.accepted = true;
// If volume is not supported, return early to avoid error logs but accepting the scroll,
// to keep the consistency of not scrolling workspaces when scrolling in the media widget.
if (!activePlayer.volumeSupported) {
return;
}
const delta = wheelEvent.angleDelta.y;
const currentVolume = (activePlayer.volume * 100) || 0;
let newVolume;
if (delta > 0) {
newVolume = Math.min(100, currentVolume + 5);
} else {
newVolume = Math.max(0, currentVolume - 5);
}
activePlayer.volume = newVolume / 100;
}
content: Component {
Item {
implicitWidth: root.playerAvailable ? root.currentContentWidth : 0