65 lines
2.0 KiB
QML
65 lines
2.0 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
import Quickshell.Io
|
|
import "../../notification/notificationServer/"
|
|
import "../../../config"
|
|
|
|
MouseArea {
|
|
id: notificationButton
|
|
width: Math.max(bar.height, notificationText.width + Config.spacing)
|
|
height: bar.height
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
// NotificationS.notificationPopupEnabled = !NotificationS.notificationPopupEnabled
|
|
console.log("[NotificationButton] Opening NotificationHistory")
|
|
root.toggleNotificationHistory()
|
|
}
|
|
|
|
// ── Report hover to NotificationServer for auto-close logic ──
|
|
onContainsMouseChanged: NotificationS.buttonHovered = containsMouse
|
|
Component.onDestruction: {
|
|
if (containsMouse) NotificationS.buttonHovered = false
|
|
}
|
|
onVisibleChanged: {
|
|
if (!visible && NotificationS.buttonHovered) NotificationS.buttonHovered = false
|
|
}
|
|
|
|
|
|
Item {
|
|
anchors.top: parent.topBar
|
|
anchors.right: parent.right
|
|
anchors.topMargin: Config.spacing
|
|
anchors.rightMargin: Config.spacing
|
|
width: Config.screen_height_to_font_tiny(screen.height)
|
|
height: Config.screen_height_to_font_tiny(screen.height)
|
|
|
|
visible: NotificationS.notificationNum > 0
|
|
|
|
Text{
|
|
anchors.centerIn: parent
|
|
text: NotificationS.notificationNum
|
|
font.family: Config.font
|
|
font.pixelSize: Config.screen_height_to_font_tiny(screen.height)
|
|
color: Colors.secondaryContainer_fg
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "transparent"
|
|
radius: Config.radius_fun(notificationButton.height)
|
|
|
|
Text {
|
|
id: notificationText
|
|
anchors.centerIn: parent
|
|
// text: Quickshell.iconPath("discord")
|
|
text: NotificationS.notificationPopupEnabled ? "" : ""
|
|
font.pixelSize: Config.bigIconSize(bar.height)
|
|
font.family: Config.font
|
|
color: Colors.secondaryContainer_fg
|
|
}
|
|
}
|
|
} |