summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/SystemTray.qml
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/SystemTray.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/SystemTray.qml52
1 files changed, 35 insertions, 17 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml
index ba678138..6f70be29 100644
--- a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml
+++ b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml
@@ -17,13 +17,17 @@ Item {
17 spacing: 0 17 spacing: 0
18 18
19 Repeater { 19 Repeater {
20 model: { 20 model: ScriptModel {
21 var trayItems = Array.from(SystemTray.items.values).filter(item => item.status !== Status.Passive); 21 values: {
22 trayItems.sort((a, b) => a.category !== b.category ? b.category - a.category : a.id.localeCompare(b.id)) 22 var trayItems = Array.from(SystemTray.items.values).filter(item => item.status !== Status.Passive);
23 return trayItems; 23 trayItems.sort((a, b) => a.category !== b.category ? b.category - a.category : a.id.localeCompare(b.id))
24 return trayItems;
25 }
24 } 26 }
25 27
26 delegate: Item { 28 delegate: Item {
29 id: trayItemWrapper
30
27 property var trayItem: modelData 31 property var trayItem: modelData
28 property string iconSource: { 32 property string iconSource: {
29 let icon = trayItem && trayItem.icon 33 let icon = trayItem && trayItem.icon
@@ -43,21 +47,11 @@ Item {
43 return "" 47 return ""
44 } 48 }
45 49
46 width: 16 50 width: icon.width + 6
47 height: parent.height 51 height: parent.height
48 anchors.verticalCenter: parent.verticalCenter 52 anchors.verticalCenter: parent.verticalCenter
49 53
50 IconImage { 54 WrapperMouseArea {
51 anchors.centerIn: parent
52 width: parent.width
53 height: parent.width
54 source: parent.iconSource
55 asynchronous: true
56 smooth: true
57 mipmap: true
58 }
59
60 MouseArea {
61 id: trayItemArea 55 id: trayItemArea
62 56
63 anchors.fill: parent 57 anchors.fill: parent
@@ -88,6 +82,26 @@ Item {
88 menuAnchor.open() 82 menuAnchor.open()
89 } 83 }
90 } 84 }
85
86 Rectangle {
87 anchors.fill: parent
88 color: {
89 if (trayItemArea.containsMouse)
90 return "#33808080";
91 return "transparent";
92 }
93
94 IconImage {
95 id: icon
96
97 anchors.centerIn: parent
98 implicitSize: 16
99 source: trayItemWrapper.iconSource
100 asynchronous: true
101 smooth: true
102 mipmap: true
103 }
104 }
91 } 105 }
92 106
93 PopupWindow { 107 PopupWindow {
@@ -112,7 +126,7 @@ Item {
112 color: "black" 126 color: "black"
113 127
114 implicitWidth: Math.max(tooltipTitle.contentWidth, tooltipDescription.contentWidth) + 16 128 implicitWidth: Math.max(tooltipTitle.contentWidth, tooltipDescription.contentWidth) + 16
115 implicitHeight: tooltipTitle.contentHeight + tooltipDescription.contentHeight + 16 129 implicitHeight: (trayItem.tooltipTitle ? tooltipTitle.contentHeight : 0) + (trayItem.tooltipDescription ? tooltipDescription.contentHeight : 0) + 16
116 130
117 WrapperMouseArea { 131 WrapperMouseArea {
118 id: tooltipMouseArea 132 id: tooltipMouseArea
@@ -126,6 +140,8 @@ Item {
126 Text { 140 Text {
127 id: tooltipTitle 141 id: tooltipTitle
128 142
143 enabled: trayItem.tooltipTitle
144
129 font.pointSize: 10 145 font.pointSize: 10
130 font.family: "Fira Sans" 146 font.family: "Fira Sans"
131 font.bold: true 147 font.bold: true
@@ -137,6 +153,8 @@ Item {
137 Text { 153 Text {
138 id: tooltipDescription 154 id: tooltipDescription
139 155
156 enabled: trayItem.tooltipDescription
157
140 font.pointSize: 10 158 font.pointSize: 10
141 font.family: "Fira Sans" 159 font.family: "Fira Sans"
142 color: "white" 160 color: "white"