diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/SystemTray.qml')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/SystemTray.qml | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml index afed4bf0..55b1690e 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 |
@@ -47,17 +51,7 @@ Item { | |||
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,21 +82,48 @@ Item { | |||
88 | menuAnchor.open() | 82 | menuAnchor.open() |
89 | } | 83 | } |
90 | } | 84 | } |
85 | |||
86 | IconImage { | ||
87 | anchors.centerIn: parent | ||
88 | width: parent.width | ||
89 | height: parent.width | ||
90 | source: trayItemWrapper.iconSource | ||
91 | asynchronous: true | ||
92 | smooth: true | ||
93 | mipmap: true | ||
94 | } | ||
91 | } | 95 | } |
92 | 96 | ||
93 | PopupWindow { | 97 | PopupWindow { |
98 | id: tooltip | ||
99 | |||
100 | property bool nextVisible: (trayItem.tooltipTitle || trayItem.tooltipDescription) && (trayItemArea.containsMouse || tooltipMouseArea.containsMouse) && !menuAnchor.visible | ||
101 | |||
94 | anchor { | 102 | anchor { |
95 | item: trayItemArea | 103 | item: trayItemArea |
96 | edges: Edges.Bottom | 104 | edges: Edges.Bottom |
97 | } | 105 | } |
98 | visible: (trayItem.tooltipTitle || trayItem.tooltipDescription) && trayItemArea.containsMouse && !menuAnchor.visible | 106 | |
107 | visible: false | ||
108 | onNextVisibleChanged: hangTimer.restart() | ||
109 | |||
110 | Timer { | ||
111 | id: hangTimer | ||
112 | interval: 100 | ||
113 | onTriggered: tooltip.visible = tooltip.nextVisible | ||
114 | } | ||
99 | 115 | ||
100 | color: "black" | 116 | color: "black" |
101 | 117 | ||
102 | implicitWidth: Math.max(tooltipTitle.contentWidth, tooltipDescription.contentWidth) + 16 | 118 | implicitWidth: Math.max(tooltipTitle.contentWidth, tooltipDescription.contentWidth) + 16 |
103 | implicitHeight: tooltipTitle.contentHeight + tooltipDescription.contentHeight + 16 | 119 | implicitHeight: tooltipTitle.contentHeight + tooltipDescription.contentHeight + 16 |
104 | 120 | ||
105 | WrapperItem { | 121 | WrapperMouseArea { |
122 | id: tooltipMouseArea | ||
123 | |||
124 | hoverEnabled: true | ||
125 | enabled: true | ||
126 | |||
106 | margin: 8 | 127 | margin: 8 |
107 | 128 | ||
108 | Column { | 129 | Column { |