diff --git a/README.md b/README.md
index cccc0e0..5e124e6 100644
--- a/README.md
+++ b/README.md
@@ -96,6 +96,7 @@ make hooks-install
The widget appearance can be tuned from the Plasma widget settings, including:
+- custom multiline label text
- title/artist vertical spacing
- NOW/PLAYING label vertical spacing
- separator gap from labels
diff --git a/package/contents/config/main.xml b/package/contents/config/main.xml
index 7733773..c0316fd 100644
--- a/package/contents/config/main.xml
+++ b/package/contents/config/main.xml
@@ -21,6 +21,11 @@
left
+
+
+
+
custom
diff --git a/package/contents/ui/Representation.qml b/package/contents/ui/Representation.qml
index 7dd2dd5..3624dab 100644
--- a/package/contents/ui/Representation.qml
+++ b/package/contents/ui/Representation.qml
@@ -10,6 +10,7 @@ MouseArea {
property string configuredFontFamily: "Noto Sans"
property string configuredLabelVisibilityMode: "auto"
property string configuredLabelPlacement: "left"
+ property string configuredLabelText: "NOW\nPLAYING"
property string configuredBackgroundStyle: "custom"
property string configuredBackgroundColor: "transparent"
property int configuredBackgroundRadius: 0
@@ -35,6 +36,7 @@ MouseArea {
readonly property int effectiveSeparatorGapLabel: Math.max(0, configuredSeparatorGapLabel)
readonly property int effectiveSeparatorGapTrack: Math.max(0, configuredSeparatorGapTrack)
readonly property int effectiveSeparatorHeight: Math.max(0, Math.min(100, configuredSeparatorHeight))
+ readonly property var effectiveLabelLines: (configuredLabelText || "").split(/\r?\n/)
readonly property bool hasTrackInfo: player.ready && (((player.title || "").trim().length > 0) || ((player.artists || "").trim().length > 0))
readonly property bool nowPlayingLabelsVisible: {
if (effectiveLabelVisibilityMode === "always")
@@ -116,30 +118,23 @@ MouseArea {
spacing: mediaControlsMouseArea.effectiveLabelVerticalSpacing
visible: mediaControlsMouseArea.nowPlayingLabelsVisible
- ShadowedLabel {
- Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
- shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
- text: "NOW"
- lineHeight: 0.8
- font.pixelSize: 16
- font.bold: true
- font.family: mediaControlsMouseArea.configuredFontFamily
- color: mediaControlsMouseArea.effectiveForegroundColor
- horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
- }
+ Repeater {
+ model: mediaControlsMouseArea.effectiveLabelLines
- ShadowedLabel {
- id: nowPlayingLabel2
+ delegate: ShadowedLabel {
+ required property string modelData
+
+ Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
+ shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
+ text: modelData
+ lineHeight: 0.8
+ font.bold: true
+ font.pixelSize: 16
+ font.family: mediaControlsMouseArea.configuredFontFamily
+ color: mediaControlsMouseArea.effectiveForegroundColor
+ horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
+ }
- Layout.alignment: mediaControlsMouseArea.labelsOnRight ? Qt.AlignLeft : Qt.AlignRight
- shadowEnabled: mediaControlsMouseArea.configuredTextShadowEnabled
- text: "PLAYING"
- lineHeight: 0.8
- font.bold: true
- font.pixelSize: 16
- font.family: mediaControlsMouseArea.configuredFontFamily
- color: mediaControlsMouseArea.effectiveForegroundColor
- horizontalAlignment: mediaControlsMouseArea.labelsOnRight ? Text.AlignLeft : Text.AlignRight
}
}
diff --git a/package/contents/ui/configGeneral.qml b/package/contents/ui/configGeneral.qml
index bf8de6c..1bc3423 100644
--- a/package/contents/ui/configGeneral.qml
+++ b/package/contents/ui/configGeneral.qml
@@ -12,6 +12,7 @@ KCM.SimpleKCM {
property string cfg_fontFamily
property string cfg_labelVisibilityMode
property string cfg_labelPlacement
+ property alias cfg_labelText: labelTextArea.text
property string cfg_backgroundStyle
property alias cfg_backgroundColor: backgroundColorField.text
property alias cfg_backgroundRadius: backgroundRadiusSpinBox.value
@@ -125,6 +126,16 @@ KCM.SimpleKCM {
onActivated: configRoot.cfg_labelPlacement = currentValue
}
+ QQC2.TextArea {
+ id: labelTextArea
+
+ Kirigami.FormData.label: i18n("Label text:")
+ Layout.fillWidth: true
+ Layout.preferredHeight: Kirigami.Units.gridUnit * 3
+ placeholderText: i18n("Use a line break for multiple lines")
+ wrapMode: TextEdit.NoWrap
+ }
+
QQC2.ComboBox {
id: backgroundStyleComboBox
diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml
index 16c0d28..78d468f 100644
--- a/package/contents/ui/main.qml
+++ b/package/contents/ui/main.qml
@@ -18,6 +18,8 @@ PlasmoidItem {
// qmllint disable missing-property
property string configuredLabelPlacement: plasmoid.configuration.labelPlacement
// qmllint disable missing-property
+ property string configuredLabelText: plasmoid.configuration.labelText
+ // qmllint disable missing-property
property string configuredBackgroundStyle: plasmoid.configuration.backgroundStyle
// qmllint disable missing-property
property string configuredBackgroundColor: plasmoid.configuration.backgroundColor
@@ -66,6 +68,7 @@ PlasmoidItem {
configuredFontFamily: root.configuredFontFamily
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
configuredLabelPlacement: root.configuredLabelPlacement
+ configuredLabelText: root.configuredLabelText
configuredBackgroundStyle: root.configuredBackgroundStyle
configuredBackgroundColor: root.configuredBackgroundColor
configuredBackgroundRadius: root.configuredBackgroundRadius
@@ -86,6 +89,7 @@ PlasmoidItem {
configuredFontFamily: root.configuredFontFamily
configuredLabelVisibilityMode: root.configuredLabelVisibilityMode
configuredLabelPlacement: root.configuredLabelPlacement
+ configuredLabelText: root.configuredLabelText
configuredBackgroundStyle: root.configuredBackgroundStyle
configuredBackgroundColor: root.configuredBackgroundColor
configuredBackgroundRadius: root.configuredBackgroundRadius