mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-15 02:02:08 -04:00
feature(notification): show notification only on current focused display (#1923)
This commit is contained in:
committed by
GitHub
parent
e9404eb9b6
commit
d58486193e
@@ -549,6 +549,7 @@ Singleton {
|
|||||||
property bool notificationHistorySaveNormal: true
|
property bool notificationHistorySaveNormal: true
|
||||||
property bool notificationHistorySaveCritical: true
|
property bool notificationHistorySaveCritical: true
|
||||||
property var notificationRules: []
|
property var notificationRules: []
|
||||||
|
property bool notificationFocusedMonitor: false
|
||||||
|
|
||||||
property bool osdAlwaysShowValue: false
|
property bool osdAlwaysShowValue: false
|
||||||
property int osdPosition: SettingsData.Position.BottomCenter
|
property int osdPosition: SettingsData.Position.BottomCenter
|
||||||
|
|||||||
@@ -363,6 +363,7 @@ var SPEC = {
|
|||||||
notificationHistorySaveNormal: { def: true },
|
notificationHistorySaveNormal: { def: true },
|
||||||
notificationHistorySaveCritical: { def: true },
|
notificationHistorySaveCritical: { def: true },
|
||||||
notificationRules: { def: [] },
|
notificationRules: { def: [] },
|
||||||
|
notificationFocusedMonitor: { def: false },
|
||||||
|
|
||||||
osdAlwaysShowValue: { def: false },
|
osdAlwaysShowValue: { def: false },
|
||||||
osdPosition: { def: 5 },
|
osdPosition: { def: 5 },
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
model: SettingsData.getFilteredScreens("notifications")
|
model: SettingsData.notificationFocusedMonitor ? Quickshell.screens : SettingsData.getFilteredScreens("notifications")
|
||||||
|
|
||||||
delegate: NotificationPopupManager {
|
delegate: NotificationPopupManager {
|
||||||
modelData: item
|
modelData: item
|
||||||
|
|||||||
@@ -108,6 +108,13 @@ QtObject {
|
|||||||
return p && p.status !== Component.Null && !p._isDestroying && p.hasValidData;
|
return p && p.status !== Component.Null && !p._isDestroying && p.hasValidData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _isFocusedScreen() {
|
||||||
|
if (!SettingsData.notificationFocusedMonitor)
|
||||||
|
return true;
|
||||||
|
const focused = CompositorService.getFocusedScreen();
|
||||||
|
return focused && manager.modelData && focused.name === manager.modelData.name;
|
||||||
|
}
|
||||||
|
|
||||||
function _sync(newWrappers) {
|
function _sync(newWrappers) {
|
||||||
for (const p of popupWindows.slice()) {
|
for (const p of popupWindows.slice()) {
|
||||||
if (!_isValidWindow(p) || p.exiting)
|
if (!_isValidWindow(p) || p.exiting)
|
||||||
@@ -118,7 +125,7 @@ QtObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const w of newWrappers) {
|
for (const w of newWrappers) {
|
||||||
if (w && !_hasWindowFor(w))
|
if (w && !_hasWindowFor(w) && _isFocusedScreen())
|
||||||
_insertAtTop(w);
|
_insertAtTop(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,6 +417,15 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("Focused monitor only")
|
||||||
|
description: I18n.tr("Show notifications only on the currently focused monitor")
|
||||||
|
visible: parent.componentId === "notifications"
|
||||||
|
checked: SettingsData.notificationFocusedMonitor
|
||||||
|
onToggled: checked => SettingsData.set("notificationFocusedMonitor", checked)
|
||||||
|
}
|
||||||
|
|
||||||
DankToggle {
|
DankToggle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: I18n.tr("Show on Last Display")
|
text: I18n.tr("Show on Last Display")
|
||||||
|
|||||||
@@ -288,6 +288,15 @@ Item {
|
|||||||
onToggled: checked => SettingsData.set("notificationPopupPrivacyMode", checked)
|
onToggled: checked => SettingsData.set("notificationPopupPrivacyMode", checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsToggleRow {
|
||||||
|
settingKey: "notificationFocusedMonitor"
|
||||||
|
tags: ["notification", "popup", "focused", "monitor", "display", "screen", "active"]
|
||||||
|
text: I18n.tr("Focused Monitor Only")
|
||||||
|
description: I18n.tr("Show notification popups only on the currently focused monitor")
|
||||||
|
checked: SettingsData.notificationFocusedMonitor
|
||||||
|
onToggled: checked => SettingsData.set("notificationFocusedMonitor", checked)
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: notificationAnimationColumn.implicitHeight + Theme.spacingM * 2
|
height: notificationAnimationColumn.implicitHeight + Theme.spacingM * 2
|
||||||
|
|||||||
Reference in New Issue
Block a user