Plasma 6 proposal: TrayRepresentation
Motivation
Currently there is no specific representation for tray items, and a widget can only have one tray item in the system tray. A tray item refers to an icon in the system tray.
Though one tray icon is enough for most widgets, this has been shown to be problematic for the kimpanel widget, where more than one icon is needed to be shown, and in the future when more privacy indicators are added, it's also necessary to group all privacy indicators for a better look.
The goal of this proposal is to add a new representation for the system tray in order to support more than one icon for one widget
Proposed solution: TrayRepresentation
It's a representation designed for the system tray.
- The shape of a single tray item must be fixed to square.
- A tray item is also a tooltip area. A widget can choose to hide the tooltip.
- A tray item can also be a clickable area, and can respond to/ignore click/wheel/keypress events.
- A tray item can also be a drop area.
- A widget can have more than one tray item, or no tray item at all (fall back to
CompactRepresentation
).- If there is a
TrayRepresentation
but noCompactRepresentation
,CompactRepresentation
will fall back toFullRepresentation
- If there is a
- Tray items from the same widget are always grouped together.
- Tray items from the same widget can be dragged as a whole in the system tray.
- At runtime, a widget can add/remove/show/hide a tray item, or change the position of a specific tray item.
Possible form
TrayItem {
toolTipMainText: "Camera Indicator"
toolTipSubText: "HD Camera is in use."
toolTipTextFormat: Text.PlainText
toolTipItem: null
source: "camera-on-symbolic"
TapHandler {
onTapped: Plasmoid.expanded = !Plasmoid.expanded
}
Kirigami.Icon {
source: "camera-on-symbolic"
}
}
In main.qml
PlasmoidItem {
trayRepresentation: [
CameraIndicator { visible: cameraInUse }
MicrophoneIndicator { visible: microphoneInUse }
RecordIndicator { visible: recording }
LocationIndicator { visible: locationServiceInUse }
]
}
PlasmoidItem {
trayRepresentation: CameraIndicator { }
}
PlasmoidItem {
compactRepresentation: CameraIndicator { }
// no trayRepresentation
}
Edited by Fushan Wen