1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 22:15:38 -05:00

Nicer notification click handlign

This commit is contained in:
bbedward
2025-07-13 11:12:08 -04:00
parent 75b9c4e224
commit c87ec06ed7
3 changed files with 39 additions and 11 deletions

View File

@@ -13,7 +13,6 @@ This is a Quickshell-based desktop shell implementation with Material Design 3 d
- **QML (Qt Modeling Language)** - Primary language for all UI components - **QML (Qt Modeling Language)** - Primary language for all UI components
- **Quickshell Framework** - QML-based framework for building desktop shells - **Quickshell Framework** - QML-based framework for building desktop shells
- **Qt/QtQuick** - UI rendering and controls - **Qt/QtQuick** - UI rendering and controls
- **Qt5Compat** - Graphical effects
- **Wayland** - Display server protocol - **Wayland** - Display server protocol
## Development Commands ## Development Commands

View File

@@ -21,19 +21,21 @@ PanelWindow {
anchors { anchors {
top: true top: true
right: true right: true
bottom: true
} }
implicitWidth: 400 margins {
top: Theme.barHeight
right: 0
}
implicitWidth: 396
implicitHeight: 116 // Just the notification area
Rectangle { Rectangle {
id: popupContainer id: popupContainer
width: 380 anchors.fill: parent
height: 100 anchors.topMargin: 16 // 16px from the top of this window
anchors.top: parent.top anchors.rightMargin: 16 // 16px from the right edge
anchors.right: parent.right
anchors.topMargin: Theme.barHeight + 16
anchors.rightMargin: 16
color: Theme.surfaceContainer color: Theme.surfaceContainer
radius: Theme.cornerRadiusLarge radius: Theme.cornerRadiusLarge
@@ -50,8 +52,9 @@ PanelWindow {
anchors.rightMargin: 36 // Don't overlap with close button anchors.rightMargin: 36 // Don't overlap with close button
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton
onClicked: { onClicked: (mouse) => {
console.log("Popup clicked!") console.log("Popup clicked!")
if (root.activeNotification) { if (root.activeNotification) {
root.handleNotificationClick(root.activeNotification) root.handleNotificationClick(root.activeNotification)
@@ -65,6 +68,7 @@ PanelWindow {
} }
// Always hide popup after click // Always hide popup after click
Utils.hideNotificationPopup() Utils.hideNotificationPopup()
mouse.accepted = true // Prevent event propagation
} }
} }
@@ -91,7 +95,11 @@ PanelWindow {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Utils.hideNotificationPopup() acceptedButtons: Qt.LeftButton
onClicked: (mouse) => {
Utils.hideNotificationPopup()
mouse.accepted = true // Prevent event propagation
}
} }
Behavior on color { Behavior on color {

View File

@@ -9,6 +9,7 @@ import Quickshell.Services.SystemTray
import Quickshell.Services.Notifications import Quickshell.Services.Notifications
import Quickshell.Services.Mpris import Quickshell.Services.Mpris
import "../../Common" import "../../Common"
import "../../Common/Utilities.js" as Utils
import "../../Services" import "../../Services"
import ".." import ".."
@@ -177,6 +178,10 @@ PanelWindow {
onClicked: { onClicked: {
if (topBar.shellRoot) { if (topBar.shellRoot) {
// Hide notification popup if visible
if (topBar.shellRoot.showNotificationPopup) {
Utils.hideNotificationPopup()
}
topBar.shellRoot.calendarVisible = !topBar.shellRoot.calendarVisible topBar.shellRoot.calendarVisible = !topBar.shellRoot.calendarVisible
} }
} }
@@ -195,6 +200,10 @@ PanelWindow {
onClicked: { onClicked: {
if (topBar.shellRoot) { if (topBar.shellRoot) {
// Hide notification popup if visible
if (topBar.shellRoot.showNotificationPopup) {
Utils.hideNotificationPopup()
}
topBar.shellRoot.calendarVisible = !topBar.shellRoot.calendarVisible topBar.shellRoot.calendarVisible = !topBar.shellRoot.calendarVisible
} }
} }
@@ -243,6 +252,10 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
// Hide notification popup if visible
if (topBar.shellRoot && topBar.shellRoot.showNotificationPopup) {
Utils.hideNotificationPopup()
}
topBar.clipboardRequested() topBar.clipboardRequested()
} }
} }
@@ -270,6 +283,10 @@ PanelWindow {
isActive: topBar.shellRoot ? topBar.shellRoot.notificationHistoryVisible : false isActive: topBar.shellRoot ? topBar.shellRoot.notificationHistoryVisible : false
onClicked: { onClicked: {
if (topBar.shellRoot) { if (topBar.shellRoot) {
// Hide notification popup if visible
if (topBar.shellRoot.showNotificationPopup) {
Utils.hideNotificationPopup()
}
topBar.shellRoot.notificationHistoryVisible = !topBar.shellRoot.notificationHistoryVisible topBar.shellRoot.notificationHistoryVisible = !topBar.shellRoot.notificationHistoryVisible
} }
} }
@@ -291,6 +308,10 @@ PanelWindow {
onClicked: { onClicked: {
if (topBar.shellRoot) { if (topBar.shellRoot) {
// Hide notification popup if visible
if (topBar.shellRoot.showNotificationPopup) {
Utils.hideNotificationPopup()
}
topBar.shellRoot.controlCenterVisible = !topBar.shellRoot.controlCenterVisible topBar.shellRoot.controlCenterVisible = !topBar.shellRoot.controlCenterVisible
if (topBar.shellRoot.controlCenterVisible) { if (topBar.shellRoot.controlCenterVisible) {
WifiService.scanWifi() WifiService.scanWifi()