1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-30 17:42:06 -04:00

Fix focused app when switching to empty workspace (#2259)

* Fix multiple screens on niri, when switching to an empty wokspace the other screen focused app widget would get confused

* Blank workspace fix
This commit is contained in:
Walid Salah
2026-04-24 16:48:24 +02:00
committed by GitHub
parent f4c11bc2ff
commit b2668a2ffc
2 changed files with 48 additions and 21 deletions

View File

@@ -371,8 +371,21 @@ Singleton {
function filterCurrentDisplay(toplevels, screenName) {
if (!toplevels || toplevels.length === 0 || !screenName)
return toplevels;
if (useNiriSorting)
if (useNiriSorting) {
const active = ToplevelManager.activeToplevel;
if (active && toplevels.length === 1 && toplevels[0] === active) {
if (NiriService.currentOutput !== screenName)
return [];
const focusedWin = NiriService.windows.find(nw => nw.is_focused);
if (!focusedWin)
return [];
const screenWsIds = new Set(
NiriService.allWorkspaces.filter(ws => ws.output === screenName).map(ws => ws.id)
);
return screenWsIds.has(focusedWin.workspace_id) ? toplevels : [];
}
return NiriService.filterCurrentDisplay(toplevels, screenName);
}
if (isHyprland)
return filterHyprlandCurrentDisplaySafe(toplevels, screenName);
return toplevels;