1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

media: block scrolling media volume in widget when no player vol avail

This commit is contained in:
bbedward
2025-12-09 23:44:37 -05:00
parent 3e08bac7f3
commit 318c50bc6c
2 changed files with 8 additions and 11 deletions

View File

@@ -49,15 +49,12 @@ BasePill {
} }
onWheel: function (wheelEvent) { onWheel: function (wheelEvent) {
if (!activePlayer) {
wheelEvent.accepted = false;
return;
}
wheelEvent.accepted = true; wheelEvent.accepted = true;
if (!usePlayerVolume)
return;
const delta = wheelEvent.angleDelta.y; const delta = wheelEvent.angleDelta.y;
const currentVolume = usePlayerVolume ? (activePlayer.volume * 100) : ((AudioService.sink?.audio?.volume ?? 0) * 100); const currentVolume = activePlayer.volume * 100;
let newVolume; let newVolume;
if (delta > 0) { if (delta > 0) {
@@ -66,11 +63,7 @@ BasePill {
newVolume = Math.max(0, currentVolume - 5); newVolume = Math.max(0, currentVolume - 5);
} }
if (usePlayerVolume) { activePlayer.volume = newVolume / 100;
activePlayer.volume = newVolume / 100;
} else if (AudioService.sink?.audio) {
AudioService.sink.audio.volume = newVolume / 100;
}
} }
content: Component { content: Component {

View File

@@ -157,6 +157,8 @@ Item {
anchors.fill: parent anchors.fill: parent
screenName: root.screenName screenName: root.screenName
visible: { visible: {
var _ = SessionData.perMonitorWallpaper
var __ = SessionData.monitorWallpapers
var currentWallpaper = SessionData.getMonitorWallpaper(screenName) var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
return !currentWallpaper || currentWallpaper === "" || (currentWallpaper && currentWallpaper.startsWith("#")) return !currentWallpaper || currentWallpaper === "" || (currentWallpaper && currentWallpaper.startsWith("#"))
} }
@@ -167,6 +169,8 @@ Item {
anchors.fill: parent anchors.fill: parent
source: { source: {
var _ = SessionData.perMonitorWallpaper
var __ = SessionData.monitorWallpapers
var currentWallpaper = SessionData.getMonitorWallpaper(screenName) var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
return (currentWallpaper && !currentWallpaper.startsWith("#")) ? currentWallpaper : "" return (currentWallpaper && !currentWallpaper.startsWith("#")) ? currentWallpaper : ""
} }