mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Reintroduce StatusNotifierModel-based system tray icons, gated on
convergenceModeEnabled. Desktop apps (KDE Connect, nm-applet, etc.)
expose tray icons that were removed in 1914e9be as unusable on
phone screens.
The status bar wrapper is raised above the ActionDrawerOpenSurface
so tray icon MouseAreas receive click events while non-interactive
areas still fall through to the swipe handler.
TaskWidget.qml supports left-click (Activate), right-click
(ContextMenu), hover tooltip, and hides Passive/ApplicationStatus
items. The lockscreen SIGABRT guard (disableSystemTray) is restored
on the action drawer's StatusBar instance.
57 lines
1.7 KiB
QML
57 lines
1.7 KiB
QML
/*
|
|
* SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org>
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
|
*/
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls as Controls
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
Item {
|
|
id: taskIcon
|
|
width: parent.height
|
|
height: width
|
|
|
|
// Hide ApplicationStatus and Passive items
|
|
opacity: (model.category !== "ApplicationStatus" && model.status !== "Passive") ? 1 : 0
|
|
onOpacityChanged: visible = opacity
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: Kirigami.Units.longDuration
|
|
easing.type: Easing.InOutQuad
|
|
}
|
|
}
|
|
|
|
Kirigami.Icon {
|
|
id: icon
|
|
source: model.iconName ? model.iconName : (model.icon ? model.icon : "")
|
|
width: Math.min(parent.width, parent.height)
|
|
height: width
|
|
anchors.centerIn: parent
|
|
}
|
|
|
|
Controls.ToolTip.text: model.toolTipTitle ? model.toolTipTitle : (model.title ? model.title : "")
|
|
Controls.ToolTip.visible: mouseArea.containsMouse && Controls.ToolTip.text !== ""
|
|
Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
onClicked: (mouse) => {
|
|
if (!model.service) {
|
|
return;
|
|
}
|
|
|
|
var operationName = mouse.button === Qt.RightButton ? "ContextMenu" : "Activate";
|
|
var operation = model.service.operationDescription(operationName);
|
|
operation.x = taskIcon.mapToGlobal(0, 0).x;
|
|
operation.y = taskIcon.mapToGlobal(0, taskIcon.height).y;
|
|
model.service.startOperationCall(operation);
|
|
}
|
|
}
|
|
}
|