forked from Shinonome/dots-hyprland
format
This commit is contained in:
@@ -77,15 +77,15 @@ const ContextMenuWorkspaceArray = ({ label, actionFunc, thisWorkspace }) => Widg
|
|||||||
const Window = ({ address, at: [x, y], size: [w, h], workspace: { id, name }, class: c, title, xwayland }, screenCoords) => {
|
const Window = ({ address, at: [x, y], size: [w, h], workspace: { id, name }, class: c, title, xwayland }, screenCoords) => {
|
||||||
const revealInfoCondition = (Math.min(w, h) * OVERVIEW_SCALE > 70);
|
const revealInfoCondition = (Math.min(w, h) * OVERVIEW_SCALE > 70);
|
||||||
if (w <= 0 || h <= 0 || (c === '' && title === '')) return null;
|
if (w <= 0 || h <= 0 || (c === '' && title === '')) return null;
|
||||||
|
// Non-primary monitors
|
||||||
if (screenCoords.x != 0) x -= screenCoords.x;
|
if (screenCoords.x != 0) x -= screenCoords.x;
|
||||||
if (screenCoords.y != 0) y -= screenCoords.y;
|
if (screenCoords.y != 0) y -= screenCoords.y;
|
||||||
|
// Other offscreen adjustments
|
||||||
if (x + w <= 0) x += (Math.floor(x / SCREEN_WIDTH) * SCREEN_WIDTH);
|
if (x + w <= 0) x += (Math.floor(x / SCREEN_WIDTH) * SCREEN_WIDTH);
|
||||||
else if (x < 0) { w = x + w; x = 0;}
|
else if (x < 0) { w = x + w; x = 0; }
|
||||||
if (y + h <= 0) x += (Math.floor(y / SCREEN_HEIGHT) * SCREEN_HEIGHT);
|
if (y + h <= 0) x += (Math.floor(y / SCREEN_HEIGHT) * SCREEN_HEIGHT);
|
||||||
else if (y < 0) { h = y + h; y = 0;}
|
else if (y < 0) { h = y + h; y = 0; }
|
||||||
|
// Truncate if offscreen
|
||||||
if (x + w > SCREEN_WIDTH) w = SCREEN_WIDTH - x;
|
if (x + w > SCREEN_WIDTH) w = SCREEN_WIDTH - x;
|
||||||
if (y + h > SCREEN_HEIGHT) h = SCREEN_HEIGHT - y;
|
if (y + h > SCREEN_HEIGHT) h = SCREEN_HEIGHT - y;
|
||||||
|
|
||||||
@@ -260,12 +260,13 @@ const OverviewRow = ({ startWorkspace, workspaces, windowName = 'overview' }) =>
|
|||||||
children: arr(startWorkspace, workspaces).map(Workspace),
|
children: arr(startWorkspace, workspaces).map(Workspace),
|
||||||
attribute: {
|
attribute: {
|
||||||
monitorMap: [],
|
monitorMap: [],
|
||||||
getMonitorMap: (box) => {execAsync('hyprctl -j monitors').then(monitors => {
|
getMonitorMap: (box) => {
|
||||||
box.attribute.monitorMap = JSON.parse(monitors).reduce((acc, item) => {
|
execAsync('hyprctl -j monitors').then(monitors => {
|
||||||
acc[item.id] = { x: item.x, y: item.y };
|
box.attribute.monitorMap = JSON.parse(monitors).reduce((acc, item) => {
|
||||||
return acc;
|
acc[item.id] = { x: item.x, y: item.y };
|
||||||
}, {});
|
return acc;
|
||||||
});
|
}, {});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
update: (box) => {
|
update: (box) => {
|
||||||
const offset = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN) * NUM_OF_WORKSPACES_SHOWN;
|
const offset = Math.floor((Hyprland.active.workspace.id - 1) / NUM_OF_WORKSPACES_SHOWN) * NUM_OF_WORKSPACES_SHOWN;
|
||||||
@@ -281,7 +282,6 @@ const OverviewRow = ({ startWorkspace, workspaces, windowName = 'overview' }) =>
|
|||||||
const screenCoords = box.attribute.monitorMap[client.monitor];
|
const screenCoords = box.attribute.monitorMap[client.monitor];
|
||||||
kids[client.workspace.id - (offset + startWorkspace)]
|
kids[client.workspace.id - (offset + startWorkspace)]
|
||||||
?.set(client, screenCoords);
|
?.set(client, screenCoords);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kids.forEach(kid => kid.show());
|
kids.forEach(kid => kid.show());
|
||||||
@@ -290,19 +290,19 @@ const OverviewRow = ({ startWorkspace, workspaces, windowName = 'overview' }) =>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup: (box) => {
|
setup: (box) => {
|
||||||
box.attribute.getMonitorMap(box)
|
box.attribute.getMonitorMap(box);
|
||||||
box
|
box
|
||||||
.hook(overviewTick, (box) => box.attribute.update(box))
|
.hook(overviewTick, (box) => box.attribute.update(box))
|
||||||
.hook(Hyprland, (box, clientAddress) => {
|
.hook(Hyprland, (box, clientAddress) => {
|
||||||
box.attribute.update(box)
|
box.attribute.update(box)
|
||||||
}, 'client-removed')
|
}, 'client-removed')
|
||||||
.hook(Hyprland, (box, clientAddress) => {
|
.hook(Hyprland, (box, clientAddress) => {
|
||||||
box.attribute.update(box);
|
box.attribute.update(box);
|
||||||
}, 'client-added')
|
}, 'client-added')
|
||||||
.hook(Hyprland.active.workspace, (box) => box.attribute.update(box))
|
.hook(Hyprland.active.workspace, (box) => box.attribute.update(box))
|
||||||
.hook(App, (box, name, visible) => { // Update on open
|
.hook(App, (box, name, visible) => { // Update on open
|
||||||
if (name == 'overview' && visible) box.attribute.update(box);
|
if (name == 'overview' && visible) box.attribute.update(box);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user