Compare commits
1 commit
95d3eb2bcc
...
686ce806c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
686ce806c8 |
5 changed files with 19 additions and 161 deletions
|
|
@ -1,99 +0,0 @@
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import qs.components
|
|
||||||
import qs.config
|
|
||||||
import qs.constants
|
|
||||||
import qs.widgets
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell.Services.Mpris
|
|
||||||
import Quickshell.Widgets
|
|
||||||
|
|
||||||
WrapperRectangle {
|
|
||||||
id: root
|
|
||||||
required property MprisPlayer player
|
|
||||||
|
|
||||||
color: Theme.palette.base200
|
|
||||||
radius: 8
|
|
||||||
margin: 16
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
implicitWidth: 800
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: {
|
|
||||||
if (root.player.identity) {
|
|
||||||
const words = root.player.identity.split("-");
|
|
||||||
const capitalized = words.map(val => String(val).charAt(0).toUpperCase() + String(val).slice(1));
|
|
||||||
console.log(capitalized);
|
|
||||||
return capitalized.join(" ");
|
|
||||||
}
|
|
||||||
return root.player.desktopEntry ?? root.player.dbusName ?? "unknown";
|
|
||||||
}
|
|
||||||
font.pixelSize: 20
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
id: text
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: `${root.player.trackTitle} - ${root.player.trackArtist}`
|
|
||||||
font.pixelSize: Dimensions.mpris.fontSize
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
StyledButton {
|
|
||||||
id: backButton
|
|
||||||
content: LucideIcon {
|
|
||||||
color: backButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent
|
|
||||||
text: Icons.skipBack
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
root.player.previous();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StyledButton {
|
|
||||||
id: playPauseButton
|
|
||||||
content: LucideIcon {
|
|
||||||
color: playPauseButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent
|
|
||||||
text: root.player.isPlaying ? Icons.square : Icons.play
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
root.player.isPlaying = !root.player.isPlaying;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StyledButton {
|
|
||||||
id: forwardButton
|
|
||||||
content: LucideIcon {
|
|
||||||
color: forwardButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent
|
|
||||||
text: Icons.skipForward
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
root.player.next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledSlider {
|
|
||||||
from: 0
|
|
||||||
to: root.player.length ?? 0
|
|
||||||
value: root.player.position
|
|
||||||
implicitHeight: 6
|
|
||||||
Layout.fillWidth: true
|
|
||||||
onMoved: {
|
|
||||||
root.player.position = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
running: root.player.isPlaying
|
|
||||||
interval: 1000
|
|
||||||
repeat: true
|
|
||||||
onTriggered: root.player.positionChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,13 +5,11 @@ import QtQuick.Controls
|
||||||
Slider {
|
Slider {
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
height: 24
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
x: control.leftPadding
|
x: control.leftPadding
|
||||||
y: control.topPadding + control.availableHeight / 2 - height / 2
|
y: control.topPadding + control.availableHeight / 2 - height / 2
|
||||||
implicitWidth: 200
|
implicitWidth: 200
|
||||||
implicitHeight: control.height
|
implicitHeight: 24
|
||||||
width: control.availableWidth
|
width: control.availableWidth
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
radius: 8
|
radius: 8
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ Singleton {
|
||||||
property string memoryStick: "\u{E44a}"
|
property string memoryStick: "\u{E44a}"
|
||||||
property string play: "\u{E140}"
|
property string play: "\u{E140}"
|
||||||
property string search: "\u{E155}"
|
property string search: "\u{E155}"
|
||||||
property string skipBack: "\u{E163}"
|
|
||||||
property string skipForward: "\u{E164}"
|
|
||||||
property string stop: "\u{E132}"
|
property string stop: "\u{E132}"
|
||||||
property string square: "\u{E16B}"
|
property string square: "\u{E16B}"
|
||||||
property string wifiOff: "\u{E1af}"
|
property string wifiOff: "\u{E1af}"
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.components
|
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
|
||||||
|
|
||||||
StyledButton {
|
StyledButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
padding: 6
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!Mpris.active.canTogglePlaying) {
|
if (!Mpris.active.canTogglePlaying) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -23,54 +19,29 @@ StyledButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content: ColumnLayout {
|
content: StyledText {
|
||||||
id: content
|
id: text
|
||||||
|
text: `${Mpris.active?.isPlaying ? "" : ""} ${Mpris.active?.trackTitle} - ${Mpris.active?.trackArtist}`
|
||||||
|
|
||||||
spacing: 0
|
font.pixelSize: Dimensions.mpris.fontSize
|
||||||
|
|
||||||
implicitWidth: text.width
|
states: State {
|
||||||
implicitHeight: text.height
|
name: "hovered"
|
||||||
StyledText {
|
when: root.containsMouse
|
||||||
id: text
|
PropertyChanges {
|
||||||
text: `${Mpris.active?.isPlaying ? "" : ""} ${Mpris.active?.trackTitle} - ${Mpris.active?.trackArtist}`
|
text {
|
||||||
|
color: Theme.palette.base300
|
||||||
font.pixelSize: Dimensions.mpris.fontSize
|
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "hovered"
|
|
||||||
when: root.containsMouse
|
|
||||||
PropertyChanges {
|
|
||||||
text {
|
|
||||||
color: Theme.palette.primarycontent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transitions: Transition {
|
|
||||||
from: ""
|
|
||||||
to: "hovered"
|
|
||||||
reversible: true
|
|
||||||
ColorAnimation {
|
|
||||||
properties: "color"
|
|
||||||
duration: 100
|
|
||||||
easing.type: Easing.InOutCubic
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StyledSlider {
|
transitions: Transition {
|
||||||
from: 0
|
from: ""
|
||||||
to: Mpris.active?.length ?? 0
|
to: "hovered"
|
||||||
value: Mpris.active?.position
|
reversible: true
|
||||||
implicitHeight: 6
|
ColorAnimation {
|
||||||
Layout.fillWidth: true
|
properties: "color"
|
||||||
onMoved: {
|
duration: 200
|
||||||
Mpris.active.position = value;
|
easing.type: Easing.InOutCubic
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
running: Mpris.active?.isPlaying
|
|
||||||
interval: 1000
|
|
||||||
repeat: true
|
|
||||||
onTriggered: Mpris.active?.positionChanged()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,16 +82,6 @@ StyledWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
StyledText {
|
|
||||||
text: "Mpris Controller"
|
|
||||||
font.pixelSize: 18
|
|
||||||
}
|
|
||||||
MprisController {
|
|
||||||
player: Mpris.active ?? null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Drawer"
|
text: "Drawer"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue