1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-08 12:13:31 -04:00

feat: unify media controls dropdown interactions, hover behavior and cycle controls (#2470)

* feat: unify media controls dropdown interactions, hover behavior and cycle controls

- Implement hover-to-show and hover-to-hide for all media control dropdowns.
- Make clicking the Output Devices and Media Players buttons cycle through items when expanded.
- Always display the 'speaker' icon for Output Devices to maintain visual consistency.
- Bind dropdown player properties dynamically to fix list stale rendering states.

* fix(DankDash): use trackArtist property for artist label in MediaPlayerTab

* fix(DankDash): simplify active player label for consistency with output devices

* feat(DankDash): display volume levels for audio output devices in dropdown

* fix(DankDash): display Unknown Artist when artist is empty in player list

* feat(DankDash): add keyboard shortcuts for seeking, track cycling and playback control in Media popout

* feat(DankDash): change Up/Down arrow keys to adjust volume in Media popout

* feat(DankDash): auto-open volume dropdown overlay when using Up/Down shortcuts

* feat(DankDash): add Key M shortcut to toggle mute in Media popout

* fix(mpris): clamp minimum seek position to 0.1s to prevent browser player reset

* fix(mpris): cache stable length to prevent browser transient reset issues

* fix(mpris): persist activePlayerStableLength in MprisController singleton

* fix(mpris): resolve browser player album art with raw metadata and YouTube url fallbacks

* fix(mpris): resolve browser player album art with local caching and 16:9 youtube fallbacks

* style(mpris): trim trailing whitespace in TrackArtService

* fix(mpris): address code review feedback on remote caching, stale artwork, and hover state

* fix: secure curl commands and prevent premature dropdown overlays closing on button re-hover
This commit is contained in:
Huỳnh Thiện Lộc
2026-05-27 00:44:51 +07:00
committed by GitHub
parent 12a744e985
commit 89f86be00a
9 changed files with 411 additions and 109 deletions
@@ -42,16 +42,22 @@ Item {
signal panelEntered
signal panelExited
property int __volumeHoverCount: 0
property int __panelHoverCount: 0
function volumeAreaEntered() {
__volumeHoverCount++;
onDropdownTypeChanged: {
if (dropdownType === 0) {
__panelHoverCount = 0;
}
}
function panelAreaEntered() {
__panelHoverCount++;
panelEntered();
}
function volumeAreaExited() {
__volumeHoverCount = Math.max(0, __volumeHoverCount - 1);
if (__volumeHoverCount === 0)
function panelAreaExited() {
__panelHoverCount = Math.max(0, __panelHoverCount - 1);
if (__panelHoverCount === 0)
panelExited();
}
@@ -131,8 +137,8 @@ Item {
anchors.fill: parent
anchors.margins: -12
hoverEnabled: true
onEntered: volumeAreaEntered()
onExited: volumeAreaExited()
onEntered: panelAreaEntered()
onExited: panelAreaExited()
}
Item {
@@ -190,8 +196,8 @@ Item {
cursorShape: Qt.PointingHandCursor
preventStealing: true
onEntered: volumeAreaEntered()
onExited: volumeAreaExited()
onEntered: panelAreaEntered()
onExited: panelAreaExited()
onPressed: mouse => updateVolume(mouse)
onPositionChanged: mouse => {
if (pressed)
@@ -269,6 +275,14 @@ Item {
shadowEnabled: Theme.elevationEnabled && !BlurService.enabled
}
MouseArea {
anchors.fill: parent
anchors.margins: -12
hoverEnabled: true
onEntered: panelAreaEntered()
onExited: panelAreaExited()
}
Column {
anchors.fill: parent
anchors.margins: Theme.spacingM
@@ -349,7 +363,13 @@ Item {
}
StyledText {
text: modelData === AudioService.sink ? "Active" : "Available"
text: {
if (!modelData?.audio)
return modelData === AudioService.sink ? I18n.tr("Active") : I18n.tr("Available");
if (modelData.audio.muted)
return I18n.tr("Muted", "audio status");
return Math.round(modelData.audio.volume * 100) + "%";
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
@@ -369,6 +389,8 @@ Item {
root.deviceSelected(modelData);
}
}
onEntered: panelAreaEntered()
onExited: panelAreaExited()
}
}
}
@@ -425,6 +447,14 @@ Item {
shadowEnabled: Theme.elevationEnabled && !BlurService.enabled
}
MouseArea {
anchors.fill: parent
anchors.margins: -12
hoverEnabled: true
onEntered: panelAreaEntered()
onExited: panelAreaExited()
}
Column {
anchors.fill: parent
anchors.margins: Theme.spacingM
@@ -498,15 +528,7 @@ Item {
}
StyledText {
text: {
if (!modelData)
return "";
const artist = modelData.trackArtist || "";
const isActive = modelData === activePlayer;
if (artist.length > 0)
return artist + (isActive ? " (Active)" : "");
return isActive ? "Active" : "Available";
}
text: modelData?.trackArtist || I18n.tr("Unknown Artist")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
@@ -526,6 +548,8 @@ Item {
root.playerSelected(modelData);
}
}
onEntered: panelAreaEntered()
onExited: panelAreaExited()
}
}
}