add border around modules for style and add mpris modules for spotify:
This commit is contained in:
parent
5057e2df26
commit
fb5aa0c9cb
@ -34,13 +34,14 @@ Variants {
|
|||||||
Row {
|
Row {
|
||||||
id: leftStuff
|
id: leftStuff
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
spacing: 20
|
spacing: 10
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Workspaces {
|
Workspaces {
|
||||||
property var screen: root.modelData
|
property var screen: root.modelData
|
||||||
}
|
}
|
||||||
Title {}
|
Title {}
|
||||||
|
Mpris {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|||||||
@ -14,6 +14,8 @@ Loader {
|
|||||||
|
|
||||||
sourceComponent: Rectangle {
|
sourceComponent: Rectangle {
|
||||||
id: container
|
id: container
|
||||||
|
border.color: Colors.color7
|
||||||
|
border.width: 1
|
||||||
radius: implicitHeight / 2
|
radius: implicitHeight / 2
|
||||||
color: Colors.color0
|
color: Colors.color0
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import qs.reusables
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: container
|
id: container
|
||||||
|
border.color: Colors.color7
|
||||||
|
border.width: 1
|
||||||
radius: implicitHeight / 2
|
radius: implicitHeight / 2
|
||||||
color: Colors.color0
|
color: Colors.color0
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|||||||
52
modules/bar/Mpris.qml
Normal file
52
modules/bar/Mpris.qml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell.Services.Mpris
|
||||||
|
import qs
|
||||||
|
import qs.settings
|
||||||
|
import qs.reusables
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: container
|
||||||
|
visible: root.getSpotify() != null
|
||||||
|
radius: implicitHeight / 2
|
||||||
|
color: Colors.color0
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
implicitWidth: root.implicitWidth + 20
|
||||||
|
implicitHeight: Settings.config.barHeight - 10
|
||||||
|
border.color: clickHandler.containsMouse ? Colors.color8 : Colors.color7
|
||||||
|
border.width: 1
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property var spotify: root.getSpotify()
|
||||||
|
function getSpotify() {
|
||||||
|
for (let i = 0; i < Mpris.players.values.length; i++) {
|
||||||
|
if (Mpris.players.values[i].identity === "Spotify") {
|
||||||
|
return Mpris.players.values[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
implicitWidth: mprisText.implicitWidth
|
||||||
|
CustomText {
|
||||||
|
id: mprisText
|
||||||
|
text: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: clickHandler
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onDoubleClicked: mouse => {
|
||||||
|
if (mouse.button == Qt.LeftButton) {
|
||||||
|
root.spotify.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onClicked: mouse => {
|
||||||
|
if (mouse.button == Qt.RightButton) {
|
||||||
|
root.spotify.togglePlaying();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,6 +11,8 @@ Rectangle {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
implicitWidth: root.implicitWidth
|
implicitWidth: root.implicitWidth
|
||||||
implicitHeight: Settings.config.barHeight - 10
|
implicitHeight: Settings.config.barHeight - 10
|
||||||
|
border.color: Colors.color7
|
||||||
|
border.width: 1
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
readonly property var activeWindow: ToplevelManager.activeToplevel
|
readonly property var activeWindow: ToplevelManager.activeToplevel
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import qs
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: container
|
id: container
|
||||||
|
border.color: Colors.color7
|
||||||
|
border.width: 1
|
||||||
radius: implicitHeight / 2
|
radius: implicitHeight / 2
|
||||||
color: Colors.color0
|
color: Colors.color0
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|||||||
@ -8,7 +8,7 @@ Text {
|
|||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
font.pixelSize: Settings.config.fontSize + 1
|
font.pixelSize: Settings.config.fontSize + 1
|
||||||
font.variableAxes: ({
|
font.variableAxes: ({
|
||||||
FILL: 1,
|
FILL: 0,
|
||||||
GRAD: 100,
|
GRAD: 100,
|
||||||
wght: 400
|
wght: 400
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user