mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
Add option to only show apps in the current workspace in the running apps widget
niri only currently - but should be simple enough to add support for others
This commit is contained in:
@@ -451,11 +451,7 @@ Singleton {
|
||||
|
||||
|
||||
|
||||
function sortToplevels(toplevels) {
|
||||
if (!toplevels || toplevels.length === 0 || !CompositorService.isNiri || windows.length === 0) {
|
||||
return [...toplevels]
|
||||
}
|
||||
|
||||
function getToplevelToNiriMap(toplevels){
|
||||
// Create a map to match toplevels to niri windows
|
||||
// We'll match by appId and title since toplevels don't have numeric IDs
|
||||
var toplevelToNiriMap = {}
|
||||
@@ -488,6 +484,15 @@ Singleton {
|
||||
}
|
||||
}
|
||||
}
|
||||
return toplevelToNiriMap
|
||||
}
|
||||
|
||||
function sortToplevels(toplevels) {
|
||||
if (!toplevels || toplevels.length === 0 || !CompositorService.isNiri || windows.length === 0) {
|
||||
return [...toplevels]
|
||||
}
|
||||
|
||||
const toplevelToNiriMap = getToplevelToNiriMap(toplevels)
|
||||
|
||||
// Sort toplevels using niri's ordering
|
||||
return [...toplevels].sort((a, b) => {
|
||||
@@ -511,4 +516,17 @@ Singleton {
|
||||
})
|
||||
}
|
||||
|
||||
function filterCurrentWorkspace(toplevels, screenName){
|
||||
const toplevelToNiriMap = getToplevelToNiriMap(toplevels)
|
||||
var currentWorkspaceId = null
|
||||
for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
|
||||
var ws = NiriService.allWorkspaces[i]
|
||||
if (ws.output === screenName && ws.is_active){
|
||||
currentWorkspaceId = ws.id
|
||||
}
|
||||
|
||||
}
|
||||
return toplevels.filter((t, idx) => toplevelToNiriMap[idx] && toplevelToNiriMap[idx].niriWindow.workspace_id == currentWorkspaceId)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user