1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

niri: handle window urgency event

fixes #1033
This commit is contained in:
bbedward
2025-12-15 12:16:43 -05:00
parent 306d7b2ce0
commit bafe1c5fee
2 changed files with 28 additions and 3 deletions

View File

@@ -842,7 +842,12 @@ Item {
wsData = modelData;
}
delegateRoot.loadedWorkspaceData = wsData;
if (CompositorService.isNiri) {
const workspaceId = wsData?.id;
delegateRoot.loadedIsUrgent = workspaceId ? NiriService.windows.some(w => w.workspace_id === workspaceId && w.is_urgent) : false;
} else {
delegateRoot.loadedIsUrgent = wsData?.urgent ?? false;
}
var icData = null;
if (wsData?.name) {
@@ -878,8 +883,8 @@ Item {
radius: Theme.cornerRadius
color: isActive ? Theme.primary : isUrgent ? Theme.error : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.outlineButton : Theme.surfaceTextAlpha
border.width: isUrgent && !isActive ? 2 : 0
border.color: isUrgent && !isActive ? Theme.error : Theme.withAlpha(Theme.error, 0)
border.width: isUrgent ? 2 : 0
border.color: isUrgent ? Theme.error : Theme.withAlpha(Theme.error, 0)
Behavior on width {
NumberAnimation {

View File

@@ -304,6 +304,9 @@ Singleton {
case 'WorkspaceUrgencyChanged':
handleWorkspaceUrgencyChanged(event.WorkspaceUrgencyChanged);
break;
case 'WindowUrgencyChanged':
handleWindowUrgencyChanged(event.WindowUrgencyChanged);
break;
case 'ScreenshotCaptured':
handleScreenshotCaptured(event.ScreenshotCaptured);
break;
@@ -571,6 +574,23 @@ Singleton {
windowUrgentChanged();
}
function handleWindowUrgencyChanged(data) {
const windowIndex = windows.findIndex(w => w.id === data.id);
if (windowIndex < 0)
return;
const updatedWindows = [...windows];
const updatedWindow = {};
for (let prop in updatedWindows[windowIndex]) {
updatedWindow[prop] = updatedWindows[windowIndex][prop];
}
updatedWindow.is_urgent = data.urgent;
updatedWindows[windowIndex] = updatedWindow;
windows = updatedWindows;
windowUrgentChanged();
}
function handleScreenshotCaptured(data) {
if (!data.path)
return;