This repository has been archived on 2026-11-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
dotfiles/mutable_config/quickshell/components/Bar/TrayTooltip.qml
T

54 lines
1.3 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 {}
Tooltip {
// 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
text: tooltipWindow.shownText
}
}