fix(ags fullscreen): consider fullscreen clients when on monitor only
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
b95ea7dde0
commit
a30007a95f
1 changed files with 8 additions and 5 deletions
|
@ -3,7 +3,6 @@ const { Box, EventBox, Revealer, Window } = Widget;
|
||||||
|
|
||||||
|
|
||||||
const FullscreenState = Variable({
|
const FullscreenState = Variable({
|
||||||
fullscreen: false,
|
|
||||||
monitors: [] as number[],
|
monitors: [] as number[],
|
||||||
clientAddrs: new Map() as Map<number, string>,
|
clientAddrs: new Map() as Map<number, string>,
|
||||||
});
|
});
|
||||||
|
@ -11,24 +10,28 @@ const FullscreenState = Variable({
|
||||||
Hyprland.connect('event', (hyprObj) => {
|
Hyprland.connect('event', (hyprObj) => {
|
||||||
const arrayEquals = (a1: unknown[], a2: unknown[]) =>
|
const arrayEquals = (a1: unknown[], a2: unknown[]) =>
|
||||||
a1.sort().toString() === a2.sort().toString();
|
a1.sort().toString() === a2.sort().toString();
|
||||||
|
|
||||||
const mapEquals = (m1: Map<number, string>, m2: Map<number, string>) =>
|
const mapEquals = (m1: Map<number, string>, m2: Map<number, string>) =>
|
||||||
m1.size === m2.size &&
|
m1.size === m2.size &&
|
||||||
Array.from(m1.keys()).every((key) => m1.get(key) === m2.get(key));
|
Array.from(m1.keys()).every((key) => m1.get(key) === m2.get(key));
|
||||||
|
|
||||||
const fs = FullscreenState.value;
|
const fs = FullscreenState.value;
|
||||||
const fsClients = hyprObj.clients.filter((c) => c.fullscreen);
|
const fsClients = hyprObj.clients.filter((c) => {
|
||||||
|
const mon = Hyprland.getMonitor(c.monitor);
|
||||||
|
|
||||||
|
return c.fullscreen &&
|
||||||
|
c.workspace.id === mon?.activeWorkspace.id;
|
||||||
|
});
|
||||||
|
|
||||||
const fullscreen = fsClients.length > 0;
|
|
||||||
const monitors = fsClients.map((c) => c.monitor);
|
const monitors = fsClients.map((c) => c.monitor);
|
||||||
const clientAddrs = new Map(fsClients.map((c) => [c.monitor, c.address]));
|
const clientAddrs = new Map(fsClients.map((c) => [c.monitor, c.address]));
|
||||||
|
|
||||||
const hasChanged = fullscreen !== fs.fullscreen ||
|
const hasChanged =
|
||||||
!arrayEquals(monitors, fs.monitors) ||
|
!arrayEquals(monitors, fs.monitors) ||
|
||||||
!mapEquals(clientAddrs, fs.clientAddrs);
|
!mapEquals(clientAddrs, fs.clientAddrs);
|
||||||
|
|
||||||
if (hasChanged) {
|
if (hasChanged) {
|
||||||
FullscreenState.setValue({
|
FullscreenState.setValue({
|
||||||
fullscreen,
|
|
||||||
monitors,
|
monitors,
|
||||||
clientAddrs,
|
clientAddrs,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue