Create Alt+tab window, refactor sortedDesktopApplications so they are inside a ListModel instead of a Map()

This commit is contained in:
2025-10-13 16:51:26 -03:00
parent f80abc48ae
commit 22c6bbf8ba
5 changed files with 189 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Hyprland
import Quickshell.Wayland
@@ -70,6 +71,34 @@ Singleton {
return sortedTopLevels.map(topLevel => topLevel.workspace);
}
property ListModel sortedDesktopApplicationsModel: ListModel {}
onSortedTopLevelsChanged: updateSortedDesktopApplications()
function updateSortedDesktopApplications() {
sortedDesktopApplicationsModel.clear();
for (const topLevel of sortedTopLevels) {
const entry = DesktopEntries.heuristicLookup(topLevel.wayland.appId);
sortedDesktopApplicationsModel.append({
topLevel: topLevel,
desktopEntry: entry
});
}
}
function workspaceApps(workspaceIndexAlign) {
const list = []
const model = sortedDesktopApplicationsModel
for (let i = 0; i < model.count; i++) {
const item = model.get(i)
if (item.topLevel.workspace.id === workspaceIndexAlign)
list.push(item.desktopEntry)
}
return list
}
property var sortedDesktopApplications: {
const sortedWayland = sortedTopLevels.map(topLevel => topLevel.wayland).filter(wayland => wayland !== null);