Skip to content

Commit 9909711

Browse files
committed
Make Tooltips more legible. Fix Firefox media info
1 parent a99129b commit 9909711

File tree

5 files changed

+31
-33
lines changed

5 files changed

+31
-33
lines changed

package/contents/config/config.qml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,4 @@ ConfigModel {
2424
icon: "preferences-desktop-navigation"
2525
source: "ConfigIndicators.qml"
2626
}
27-
property int test: {
28-
for(var key in parent){
29-
console.log(key)
30-
console.log(parent[key])
31-
}
32-
return 0
33-
}
3427
}

package/contents/ui/PlayerController.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ RowLayout {
2121
readonly property string mprisSourceName: mpris2Source.sourceNameForLauncherUrl(launcherUrl, appPid)
2222
readonly property var playerData: mprisSourceName != "" ? mpris2Source.data[mprisSourceName] : 0
2323
readonly property bool playing: !!(playerData.PlaybackStatus === "Playing")
24+
property string parentTitle
2425

25-
readonly property var currentMetadata: !!playerData ? playerData.Metadata : ""
26+
property var currentMetadata: !!playerData ? playerData.Metadata : ""
2627

2728
readonly property string track: {
2829
const xesamTitle = currentMetadata["xesam:title"]
@@ -68,6 +69,7 @@ RowLayout {
6869
wrapMode: Text.NoWrap
6970
elide: parent.state ? Text.ElideNone : Text.ElideRight
7071
text: track
72+
visible: !parentTitle.includes(track)
7173
textFormat: Text.PlainText
7274
}
7375
}

package/contents/ui/Task.qml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,6 @@ MouseArea {
377377
leftMargin: ((inPopup || tasks.vertical) && taskList.columns > 1) ? LayoutManager.iconMargin : 0
378378
rightMargin: ((inPopup || tasks.vertical) && taskList.columns > 1) ? LayoutManager.iconMargin : 0
379379
}
380-
property int test: {
381-
console.log(task.state);
382-
return 0
383-
}
384380
imagePath: plasmoid.configuration.disableButtonSvg ? "" : "widgets/tasks"
385381
enabledBorders: plasmoid.configuration.useBorders ? 1 | 2 | 4 | 8 : 0
386382
property bool isHovered: task.highlighted && plasmoid.configuration.taskHoverEffect

package/contents/ui/ToolTipInstance.qml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ ColumnLayout {
3939
} else {
4040
text = displayParent;
4141
}
42-
43-
// KWin appends increasing integers in between pointy brackets to otherwise equal window titles.
44-
// In this case save <#number> as counter and delete it at the end of text.
45-
text = `${(text.match(/.*(?=\s*(—|-))/) || [""])[0]}${(text.match(/<\d+>/) || [""]).pop()}`;
46-
47-
// In case the window title had only redundant information (i.e. appName), text is now empty.
42+
// KWin only appends brackets to names that are duplicated, therefore this feature has been removed as unnecessary and probably self-obsoleted, and only worked in reverse.
4843
// Add a hyphen to indicate that and avoid empty space.
4944
if (text === "") {
5045
text = "";
@@ -72,28 +67,29 @@ ColumnLayout {
7267
// all textlabels
7368
ColumnLayout {
7469
spacing: 0
75-
// app name
70+
71+
72+
// window title
7673
PlasmaExtras.Heading {
77-
id: appNameHeading
74+
id: winTitle
7875
level: 3
7976
maximumLineCount: 1
8077
lineHeight: isWin ? 1 : appNameHeading.lineHeight
8178
Layout.fillWidth: true
8279
elide: Text.ElideRight
83-
text: appName
84-
opacity: flatIndex == 0
85-
visible: text.length !== 0
80+
text: title
81+
visible: title.length !== 0
8682
textFormat: Text.PlainText
8783
}
88-
// window title
84+
// app name
8985
PlasmaComponents3.Label {
90-
id: winTitle
86+
id: appNameHeading
9187
maximumLineCount: 1
9288
Layout.fillWidth: true
9389
elide: Text.ElideRight
94-
text: titleIncludesTrack ? "" : title
90+
text: appName
9591
opacity: 0.75
96-
visible: title.length !== 0 && title !== appNameHeading.text
92+
visible: text.length !== 0 && appNameHeading.text !== title
9793
textFormat: Text.PlainText
9894
}
9995
// subtext
@@ -102,7 +98,7 @@ ColumnLayout {
10298
maximumLineCount: 1
10399
Layout.fillWidth: true
104100
elide: Text.ElideRight
105-
text: isWin ? generateSubText() : ""
101+
text: generateSubText()
106102
opacity: 0.6
107103
visible: text.length !== 0 && text !== appNameHeading.text
108104
textFormat: Text.PlainText
@@ -253,14 +249,13 @@ ColumnLayout {
253249
// in all other cases we can safely show the album art without checking the title
254250
readonly property bool available: (status === Image.Ready || status === Image.Loading)
255251
&& (!(isGroup || backend.applicationCategories(launcherUrl).includes("WebBrowser")) || titleIncludesTrack)
256-
257252
anchors.fill: hoverHandler
258253
// Indent by one pixel to make sure we never cover up the entire highlight
259254
anchors.margins: 1
260255
sourceSize: Qt.size(parent.width, parent.height)
261256

262257
asynchronous: true
263-
source: playerController.item ? playerController.item.albumArt : ""
258+
source: playerController.item ? playerController.item.albumArt.split("?")[0] : ""
264259
fillMode: Image.PreserveAspectFit
265260
visible: available
266261
}
@@ -284,6 +279,11 @@ ColumnLayout {
284279
active: hasPlayer && flatIndex !== -1 // Avoid loading when the instance is going to be destroyed
285280
asynchronous: true
286281
visible: active
282+
Binding {
283+
target: playerController.item
284+
property: "parentTitle"
285+
value: title
286+
}
287287
Layout.fillWidth: true
288288
Layout.maximumWidth: header.Layout.maximumWidth
289289
Layout.leftMargin: header.Layout.margins

package/contents/ui/main.qml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ MouseArea {
216216
PlasmaCore.DataSource {
217217
id: mpris2Source
218218
engine: "mpris2"
219+
interval: 100 // update ondemand
219220
connectedSources: sources
220221
onSourceAdded: {
221222
connectSource(source);
@@ -243,12 +244,18 @@ MouseArea {
243244
if (source === "@multiplex") {
244245
continue;
245246
}
246-
247+
247248
var sourceData = data[source];
248-
if (!sourceData) {
249+
if (!sourceData && mpris2Source.data[source]['Metadata']["xesam:artist"] != "" ) {
249250
continue;
250251
}
251-
252+
if(desktopFileName === "firefox"){//Hack to replace firefox with the plasma browser integration if it's availalbe.
253+
for (var x = 0, length = connectedSources.length; x < length; ++x) {
254+
if(connectedSources[x] === "plasma-browser-integration"){
255+
return connectedSources[x]
256+
}
257+
}
258+
}
252259
/**
253260
* If the task is in a group, we can't use desktopFileName to match the task.
254261
* but in case PID match fails, use the match result from desktopFileName.

0 commit comments

Comments
 (0)