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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user