Create Alt+tab window, refactor sortedDesktopApplications so they are inside a ListModel instead of a Map()
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user