pass desktop to Workspace.clientArea
This commit is contained in:
2
src/extern/kwin.d.ts
vendored
2
src/extern/kwin.d.ts
vendored
@@ -21,7 +21,7 @@ declare const Workspace: {
|
||||
readonly currentActivityChanged: QSignal<[]>;
|
||||
readonly virtualScreenSizeChanged: QSignal<[]>;
|
||||
|
||||
clientArea(option: ClientAreaOption, output: Output, desktopNumber: number);
|
||||
clientArea(option: ClientAreaOption, output: Output, kwinDesktop: KwinDesktop);
|
||||
};
|
||||
|
||||
const enum ClientAreaOption {
|
||||
|
||||
@@ -38,7 +38,7 @@ class Desktop {
|
||||
}
|
||||
|
||||
private static getClientArea(kwinDesktop: KwinDesktop) {
|
||||
return Workspace.clientArea(ClientAreaOption.PlacementArea, Workspace.activeScreen, 0); // TODO: pass desktop
|
||||
return Workspace.clientArea(ClientAreaOption.PlacementArea, Workspace.activeScreen, kwinDesktop);
|
||||
}
|
||||
|
||||
private static getTilingArea(clientArea: QmlRect, kwinDesktop: KwinDesktop, pinManager: PinManager, config: Desktop.Config) {
|
||||
|
||||
@@ -19,13 +19,28 @@ namespace Clients {
|
||||
}
|
||||
}
|
||||
|
||||
export function getKwinDesktopApprox(kwinClient: KwinClient) {
|
||||
switch (kwinClient.desktops.length) {
|
||||
case 0: // TODO: is empty = all desktops?
|
||||
return Workspace.currentDesktop;
|
||||
case 1:
|
||||
return kwinClient.desktops[0];
|
||||
default:
|
||||
if (kwinClient.desktops.includes(Workspace.currentDesktop)) {
|
||||
return Workspace.currentDesktop;
|
||||
} else {
|
||||
return kwinClient.desktops[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isMaximizedGeometry(kwinClient: KwinClient) {
|
||||
const maximizeArea = Workspace.clientArea(ClientAreaOption.MaximizeArea, kwinClient.output, 0); // TODO: pass desktop
|
||||
const maximizeArea = Workspace.clientArea(ClientAreaOption.MaximizeArea, kwinClient.output, getKwinDesktopApprox(kwinClient));
|
||||
return kwinClient.frameGeometry === maximizeArea;
|
||||
}
|
||||
|
||||
export function isFullScreenGeometry(kwinClient: KwinClient) {
|
||||
const fullScreenArea = Workspace.clientArea(ClientAreaOption.FullScreenArea, kwinClient.output, 0); // TODO: pass desktop
|
||||
const fullScreenArea = Workspace.clientArea(ClientAreaOption.FullScreenArea, kwinClient.output, getKwinDesktopApprox(kwinClient));
|
||||
return kwinClient.frameGeometry === fullScreenArea;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,11 @@ namespace ClientState {
|
||||
}
|
||||
|
||||
private static limitHeight(client: ClientWrapper) {
|
||||
const placementArea = Workspace.clientArea(ClientAreaOption.PlacementArea, client.kwinClient.output, 0); // TODO: pass desktop
|
||||
const placementArea = Workspace.clientArea(
|
||||
ClientAreaOption.PlacementArea,
|
||||
client.kwinClient.output,
|
||||
Clients.getKwinDesktopApprox(client.kwinClient),
|
||||
);
|
||||
const clientRect = client.kwinClient.frameGeometry;
|
||||
const width = client.preferredWidth;
|
||||
client.place(
|
||||
|
||||
Reference in New Issue
Block a user