Notification backend usable
This commit is contained in:
@@ -10,70 +10,68 @@ Singleton {
|
||||
|
||||
property var sortedTopLevels: {
|
||||
if (!ToplevelManager.toplevels || !ToplevelManager.toplevels.values) {
|
||||
return []
|
||||
return [];
|
||||
}
|
||||
|
||||
const topLevels = Array.from(Hyprland.toplevels.values)
|
||||
const topLevels = Array.from(Hyprland.toplevels.values);
|
||||
const sortedHyprland = topLevels.sort((a, b) => {
|
||||
if (a.monitor && b.monitor) {
|
||||
const monitorCompare = a.monitor.name.localeCompare(b.monitor.name)
|
||||
if (monitorCompare !== 0) {
|
||||
return monitorCompare
|
||||
}
|
||||
}
|
||||
if (a.monitor && b.monitor) {
|
||||
const monitorCompare = a.monitor.name.localeCompare(b.monitor.name);
|
||||
if (monitorCompare !== 0) {
|
||||
return monitorCompare;
|
||||
}
|
||||
}
|
||||
|
||||
if (a.workspace && b.workspace) {
|
||||
const workspaceCompare = a.workspace.id - b.workspace.id
|
||||
if (workspaceCompare !== 0) {
|
||||
return workspaceCompare
|
||||
}
|
||||
}
|
||||
if (a.workspace && b.workspace) {
|
||||
const workspaceCompare = a.workspace.id - b.workspace.id;
|
||||
if (workspaceCompare !== 0) {
|
||||
return workspaceCompare;
|
||||
}
|
||||
}
|
||||
|
||||
if (a.lastIpcObject && b.lastIpcObject && a.lastIpcObject.at && b.lastIpcObject.at) {
|
||||
const aX = a.lastIpcObject.at[0]
|
||||
const bX = b.lastIpcObject.at[0]
|
||||
const aY = a.lastIpcObject.at[1]
|
||||
const bY = b.lastIpcObject.at[1]
|
||||
if (a.lastIpcObject && b.lastIpcObject && a.lastIpcObject.at && b.lastIpcObject.at) {
|
||||
const aX = a.lastIpcObject.at[0];
|
||||
const bX = b.lastIpcObject.at[0];
|
||||
const aY = a.lastIpcObject.at[1];
|
||||
const bY = b.lastIpcObject.at[1];
|
||||
|
||||
const xCompare = aX - bX
|
||||
if (Math.abs(xCompare) > 10) {
|
||||
return xCompare
|
||||
}
|
||||
return aY - bY
|
||||
}
|
||||
const xCompare = aX - bX;
|
||||
if (Math.abs(xCompare) > 10) {
|
||||
return xCompare;
|
||||
}
|
||||
return aY - bY;
|
||||
}
|
||||
|
||||
if (a.lastIpcObject && !b.lastIpcObject) {
|
||||
return -1
|
||||
}
|
||||
if (!a.lastIpcObject && b.lastIpcObject) {
|
||||
return 1
|
||||
}
|
||||
if (a.lastIpcObject && !b.lastIpcObject) {
|
||||
return -1;
|
||||
}
|
||||
if (!a.lastIpcObject && b.lastIpcObject) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (a.title && b.title) {
|
||||
return a.title.localeCompare(b.title)
|
||||
}
|
||||
|
||||
return 0
|
||||
})
|
||||
return sortedHyprland.filter(tl => tl.wayland !== null)
|
||||
if (a.title && b.title) {
|
||||
return a.title.localeCompare(b.title);
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
return sortedHyprland.filter(tl => tl.wayland !== null);
|
||||
}
|
||||
|
||||
property var topLevelWorkspaces: {
|
||||
return sortedTopLevels.map(topLevel => topLevel.workspace)
|
||||
return sortedTopLevels.map(topLevel => topLevel.workspace);
|
||||
}
|
||||
|
||||
property var sortedDesktopApplications: {
|
||||
const sortedWayland = sortedTopLevels.map(topLevel => topLevel.wayland).filter(wayland=> wayland !== null)
|
||||
|
||||
const desktopEntries = sortedWayland.map( topLevel => {
|
||||
return DesktopEntries.heuristicLookup(topLevel.appId)
|
||||
})
|
||||
const workspace = sortedTopLevels.map( topLevel => {
|
||||
return topLevel.workspace.id
|
||||
})
|
||||
const workspaceDesktopEntries = new Map()
|
||||
const sortedWayland = sortedTopLevels.map(topLevel => topLevel.wayland).filter(wayland => wayland !== null);
|
||||
|
||||
const desktopEntries = sortedWayland.map(topLevel => {
|
||||
return DesktopEntries.heuristicLookup(topLevel.appId);
|
||||
});
|
||||
const workspace = sortedTopLevels.map(topLevel => {
|
||||
return topLevel.workspace.id;
|
||||
});
|
||||
const workspaceDesktopEntries = new Map();
|
||||
|
||||
for (let i = 0; i < workspace.length; i++) {
|
||||
const key = workspace[i];
|
||||
@@ -85,8 +83,6 @@ Singleton {
|
||||
workspaceDesktopEntries.set(key, [value]);
|
||||
}
|
||||
}
|
||||
return workspaceDesktopEntries
|
||||
|
||||
return workspaceDesktopEntries;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user