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);
|
||||
|
||||
|
||||
@@ -62,13 +62,13 @@ Singleton {
|
||||
StyledText {
|
||||
text: {
|
||||
if (!HoverMediator.component?.model)
|
||||
return "";
|
||||
return "";
|
||||
if (HoverMediator.component.model.tooltipTitle)
|
||||
return HoverMediator.component.model.tooltipTitle;
|
||||
return HoverMediator.component.model.tooltipTitle;
|
||||
if (HoverMediator.component.model.title)
|
||||
return HoverMediator.component.model.title;
|
||||
return HoverMediator.component.model.title;
|
||||
else
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ Singleton {
|
||||
Component {
|
||||
id: time
|
||||
|
||||
RowLayout{
|
||||
RowLayout {
|
||||
id: rowlayoutCalendar
|
||||
|
||||
readonly property date now: new Date()
|
||||
@@ -132,9 +132,7 @@ Singleton {
|
||||
|
||||
Repeater {
|
||||
|
||||
property var modelo: HyprlandService.sortedDesktopApplications.get(parent.workspaceIndexAlign)
|
||||
|
||||
model: modelo
|
||||
model: HyprlandService.workspaceApps(parent.workspaceIndexAlign)
|
||||
delegate: IconImage {
|
||||
|
||||
required property var modelData
|
||||
@@ -172,15 +170,15 @@ Singleton {
|
||||
id: hoverLoader
|
||||
sourceComponent: {
|
||||
if (!HoverMediator.type)
|
||||
return stub;
|
||||
return stub;
|
||||
if (HoverMediator.type === "workspace")
|
||||
return workspaceComponent;
|
||||
return workspaceComponent;
|
||||
if (HoverMediator.type === "audio")
|
||||
return audio;
|
||||
return audio;
|
||||
if (HoverMediator.type === "time")
|
||||
return time;
|
||||
return time;
|
||||
if (HoverMediator.type === "systray")
|
||||
return systray;
|
||||
return systray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user