mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-15 07:35:20 -04:00
feat(media-control): support scroll and right-click on audio output devices in media popout (#2615)
* feat(media-control): support scroll and right-click on audio output devices in media popout * feat(media-control): make device list volume scrolling optional
This commit is contained in:
@@ -108,9 +108,6 @@ DankPopout {
|
||||
MprisController.setActivePlayer(player);
|
||||
root.__hideDropdowns();
|
||||
}
|
||||
onDeviceSelected: device => {
|
||||
root.__hideDropdowns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -383,7 +383,27 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onPressed: mouse => {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
mouse.accepted = true;
|
||||
}
|
||||
}
|
||||
onWheel: wheelEvent => {
|
||||
if (SettingsData.audioDeviceScrollVolumeEnabled && wheelEvent.x >= deviceMouseArea.width / 2) {
|
||||
AudioService.handleNodeVolumeWheel(modelData, wheelEvent);
|
||||
} else {
|
||||
wheelEvent.accepted = false;
|
||||
}
|
||||
}
|
||||
onClicked: mouse => {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
if (modelData && modelData.audio) {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
modelData.audio.muted = !modelData.audio.muted;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (modelData && modelData.name) {
|
||||
AudioService.setDefaultSinkByName(modelData.name);
|
||||
root.deviceSelected(modelData);
|
||||
|
||||
@@ -866,7 +866,27 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onPressed: mouse => {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
mouse.accepted = true;
|
||||
}
|
||||
}
|
||||
onWheel: wheelEvent => {
|
||||
const delta = wheelEvent.angleDelta.y;
|
||||
if (delta !== 0) {
|
||||
AudioService.cycleAudioOutputDirection(delta < 0);
|
||||
wheelEvent.accepted = true;
|
||||
}
|
||||
}
|
||||
onClicked: mouse => {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
if (AudioService.sink?.audio) {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
AudioService.sink.audio.muted = !AudioService.sink.audio.muted;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (devicesExpanded) {
|
||||
const sinks = AudioService.getAvailableSinks();
|
||||
if (sinks && sinks.length > 1) {
|
||||
|
||||
@@ -113,6 +113,13 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
text: I18n.tr("Device list scroll volume")
|
||||
description: I18n.tr("Allow adjusting device volume by scrolling on the right half of items in the device list")
|
||||
checked: SettingsData.audioDeviceScrollVolumeEnabled
|
||||
onToggled: checked => SettingsData.set("audioDeviceScrollVolumeEnabled", checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user