Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ZYoSQwwYWhJHLX6VBCGnF
68 lines
1.8 KiB
QML
68 lines
1.8 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import "../Shared"
|
|
|
|
// Full-screen, click-through overlay used to render tray icon tooltips.
|
|
// Kept as its own window so the Bar's own surface can stay exactly as tall
|
|
// as the pill itself (no shadow/margin bloat from an oversized surface).
|
|
PanelWindow {
|
|
id: tooltipWindow
|
|
|
|
property string shownText: ""
|
|
property real anchorX: 0
|
|
property real anchorY: 0
|
|
|
|
function showAt(x, y, text) {
|
|
anchorX = x;
|
|
anchorY = y;
|
|
shownText = text;
|
|
}
|
|
|
|
function hide() {
|
|
shownText = "";
|
|
}
|
|
|
|
anchors {
|
|
top: true
|
|
left: true
|
|
right: true
|
|
bottom: true
|
|
}
|
|
|
|
exclusiveZone: 0
|
|
color: "transparent"
|
|
visible: shownText.length > 0
|
|
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
WlrLayershell.namespace: "quickshell-tray-tooltip"
|
|
|
|
// Never accept input; this window only ever draws a small label.
|
|
mask: Region {}
|
|
|
|
Rectangle {
|
|
// anchorX is the icon's horizontal center; center this bubble on it,
|
|
// clamped so it never runs past the screen edges.
|
|
x: Math.max(
|
|
Theme.geometry.spacing,
|
|
Math.min(tooltipWindow.anchorX - width / 2, tooltipWindow.width - width - Theme.geometry.spacing)
|
|
)
|
|
y: tooltipWindow.anchorY
|
|
radius: Theme.geometry.radiusMedium
|
|
color: Theme.colors.background
|
|
border.color: Theme.colors.border
|
|
border.width: 1
|
|
width: label.implicitWidth + Theme.geometry.padding * 2
|
|
height: label.implicitHeight + Theme.geometry.padding
|
|
|
|
Text {
|
|
id: label
|
|
anchors.centerIn: parent
|
|
text: tooltipWindow.shownText
|
|
color: Theme.colors.text
|
|
font.family: Theme.font.family
|
|
font.pixelSize: 11
|
|
}
|
|
}
|
|
}
|