rework mpris, less features but easier to build out player selector later
This commit is contained in:
parent
a7e916519f
commit
c3a1bb4553
5 changed files with 60 additions and 94 deletions
48
modules/bar/components/Mpris.qml
Normal file
48
modules/bar/components/Mpris.qml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.config
|
||||
import qs.services
|
||||
import qs.widgets
|
||||
import QtQuick
|
||||
|
||||
StyledButton {
|
||||
id: root
|
||||
|
||||
onClicked: {
|
||||
if (!Mpris.active.canTogglePlaying) {
|
||||
return;
|
||||
}
|
||||
if (Mpris.active.isPlaying) {
|
||||
Mpris.active.pause();
|
||||
} else {
|
||||
Mpris.active.play();
|
||||
}
|
||||
}
|
||||
|
||||
content: StyledText {
|
||||
id: text
|
||||
text: `${Mpris.active?.isPlaying ? "" : ""} ${Mpris.active?.trackTitle} - ${Mpris.active?.trackArtist}`
|
||||
|
||||
font.pixelSize: Dimensions.mpris.fontSize
|
||||
|
||||
states: State {
|
||||
name: "hovered"
|
||||
when: root.containsMouse
|
||||
PropertyChanges {
|
||||
text {
|
||||
color: Theme.palette.base300
|
||||
}
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
from: ""
|
||||
to: "hovered"
|
||||
reversible: true
|
||||
ColorAnimation {
|
||||
properties: "color"
|
||||
duration: 200
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue