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