mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
feat: Opt to display notifications over fullscreen apps
This commit is contained in:
@@ -89,6 +89,7 @@ Singleton {
|
||||
property bool showDock: false
|
||||
property bool dockAutoHide: false
|
||||
property real cornerRadius: 12
|
||||
property bool notificationOverlayEnabled: false
|
||||
|
||||
readonly property string defaultFontFamily: "Inter Variable"
|
||||
readonly property string defaultMonoFontFamily: "Fira Code"
|
||||
@@ -253,6 +254,7 @@ Singleton {
|
||||
showDock = settings.showDock !== undefined ? settings.showDock : false
|
||||
dockAutoHide = settings.dockAutoHide !== undefined ? settings.dockAutoHide : false
|
||||
cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12
|
||||
notificationOverlayEnabled = settings.notificationOverlayEnabled !== undefined ? settings.notificationOverlayEnabled : false
|
||||
applyStoredTheme()
|
||||
detectAvailableIconThemes()
|
||||
detectQtTools()
|
||||
@@ -321,7 +323,8 @@ Singleton {
|
||||
"qtThemingEnabled": qtThemingEnabled,
|
||||
"showDock": showDock,
|
||||
"dockAutoHide": dockAutoHide,
|
||||
"cornerRadius": cornerRadius
|
||||
"cornerRadius": cornerRadius,
|
||||
"notificationOverlayEnabled": notificationOverlayEnabled
|
||||
}, null, 2))
|
||||
}
|
||||
|
||||
@@ -738,6 +741,11 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setNotificationOverlayEnabled(enabled) {
|
||||
notificationOverlayEnabled = enabled
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function _shq(s) {
|
||||
return "'" + String(s).replace(/'/g, "'\\''") + "'"
|
||||
}
|
||||
|
||||
@@ -58,8 +58,17 @@ PanelWindow {
|
||||
}
|
||||
|
||||
visible: hasValidData
|
||||
WlrLayershell.layer: notificationData && notificationData.urgency
|
||||
=== NotificationUrgency.Critical ? WlrLayershell.Overlay : WlrLayershell.Top
|
||||
WlrLayershell.layer: {
|
||||
if (!notificationData) return WlrLayershell.Top
|
||||
|
||||
SettingsData.notificationOverlayEnabled
|
||||
|
||||
// If overlay is enabled for all notifications, or if it's a critical notification
|
||||
const shouldUseOverlay = (SettingsData.notificationOverlayEnabled) ||
|
||||
(notificationData.urgency === NotificationUrgency.Critical)
|
||||
|
||||
return shouldUseOverlay ? WlrLayershell.Overlay : WlrLayershell.Top
|
||||
}
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
color: "transparent"
|
||||
|
||||
@@ -45,6 +45,11 @@ Item {
|
||||
width: parent.width
|
||||
sourceComponent: dynamicThemeComponent
|
||||
}
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: notificationOverlayComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -879,4 +884,69 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Notification Overlay Component
|
||||
Component {
|
||||
id: notificationOverlayComponent
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: notificationOverlaySection.implicitHeight + Theme.spacingL * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
|
||||
Theme.surfaceVariant.b, 0.3)
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.2)
|
||||
border.width: 1
|
||||
|
||||
Column {
|
||||
id: notificationOverlaySection
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingL
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
DankIcon {
|
||||
name: "notifications_active"
|
||||
size: Theme.iconSize
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width - Theme.iconSize - Theme.spacingM - overlayToggle.width - Theme.spacingM
|
||||
spacing: Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: "Notification Overlay"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Enable to display all notification priorities over fullscreen apps"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: overlayToggle
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: SettingsData.notificationOverlayEnabled
|
||||
onToggled: toggled => SettingsData.setNotificationOverlayEnabled(toggled)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user