summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml
diff options
context:
space:
mode:
authorNippy <nippy@rp1.hu>2026-05-08 19:50:49 +0200
committerNippy <nippy@rp1.hu>2026-05-08 19:50:49 +0200
commit3462bcc46ecf74f576ea4397f16492c16bd75b10 (patch)
treec5ab7aef4498647e057bda8d49c11e5f9dda74c9 /raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml
parent56616f693b4f263cbf0d47da43b67424efa6022d (diff)
downloadRaveOS-PKGBUILD-3462bcc46ecf74f576ea4397f16492c16bd75b10.tar.gz
RaveOS-PKGBUILD-3462bcc46ecf74f576ea4397f16492c16bd75b10.zip
raveos update
Diffstat (limited to 'raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml')
-rw-r--r--raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml92
1 files changed, 92 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml b/raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml
new file mode 100644
index 0000000..0e57de9
--- /dev/null
+++ b/raveos-hyprland-theme/theme-data/dms/Widgets/DankTooltip.qml
@@ -0,0 +1,92 @@
+import QtQuick
+import Quickshell
+import Quickshell.Wayland
+import qs.Common
+
+PanelWindow {
+ id: root
+
+ WlrLayershell.namespace: "dms:tooltip"
+
+ property string text: ""
+ property real targetX: 0
+ property real targetY: 0
+ property var targetScreen: null
+ property bool alignLeft: false
+ property bool alignRight: false
+
+ function show(text, x, y, screen, leftAlign, rightAlign) {
+ root.text = text;
+ if (screen) {
+ targetScreen = screen;
+ const screenX = screen.x || 0;
+ targetX = x - screenX;
+ } else {
+ targetScreen = null;
+ targetX = x;
+ }
+ targetY = y;
+ alignLeft = leftAlign ?? false;
+ alignRight = rightAlign ?? false;
+ visible = true;
+ }
+
+ function hide() {
+ visible = false;
+ }
+
+ screen: targetScreen
+ implicitWidth: Math.min(300, Math.max(120, textContent.implicitWidth + Theme.spacingM * 2))
+ implicitHeight: textContent.implicitHeight + Theme.spacingS * 2
+ color: "transparent"
+ visible: false
+ WlrLayershell.layer: WlrLayershell.Overlay
+ WlrLayershell.exclusiveZone: -1
+
+ anchors {
+ top: true
+ left: true
+ }
+
+ margins {
+ left: {
+ const screenWidth = targetScreen?.width ?? Screen.width
+ if (alignLeft) {
+ return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX)))
+ } else if (alignRight) {
+ return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX - implicitWidth)))
+ } else {
+ return Math.round(Math.max(Theme.spacingS, Math.min(screenWidth - implicitWidth - Theme.spacingS, targetX - implicitWidth / 2)))
+ }
+ }
+ top: {
+ const screenHeight = targetScreen?.height ?? Screen.height
+ if (alignLeft || alignRight) {
+ return Math.round(Math.max(Theme.spacingS, Math.min(screenHeight - implicitHeight - Theme.spacingS, targetY - implicitHeight / 2)))
+ } else {
+ return Math.round(Math.max(Theme.spacingS, Math.min(screenHeight - implicitHeight - Theme.spacingS, targetY)))
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
+ radius: Theme.cornerRadius
+ border.width: 1
+ border.color: Theme.outlineMedium
+
+ Text {
+ id: textContent
+
+ anchors.centerIn: parent
+ text: root.text
+ font.pixelSize: Theme.fontSizeSmall
+ color: Theme.surfaceText
+ wrapMode: Text.NoWrap
+ maximumLineCount: 1
+ elide: Text.ElideRight
+ width: Math.min(implicitWidth, 300 - Theme.spacingM * 2)
+ }
+ }
+}