kwin.d.ts: rename Workspace

This commit is contained in:
Peter Fajdiga
2024-03-02 21:10:30 +01:00
parent 7f71750a8e
commit c8f022d66f
9 changed files with 30 additions and 30 deletions

View File

@@ -128,7 +128,7 @@ namespace Actions {
},
windowToggleFloating: () => {
const kwinClient = workspace.activeClient;
const kwinClient = Workspace.activeClient;
world.do((clientManager, desktopManager) => {
clientManager.toggleFloatingClient(kwinClient);
});

View File

@@ -3,7 +3,7 @@ declare const KWin: {
registerShortcut(name: string, description: string, keySequence: string, callback: () => void): void;
};
declare const workspace: {
declare const Workspace: {
readonly desktops: number;
readonly currentDesktop: number;
readonly currentActivity: string;

View File

@@ -38,7 +38,7 @@ class Desktop {
}
private static getClientArea(desktopNumber: number) {
return workspace.clientArea(ClientAreaOption.PlacementArea, 0, desktopNumber);
return Workspace.clientArea(ClientAreaOption.PlacementArea, 0, desktopNumber);
}
private static getTilingArea(clientArea: QmlRect, desktopNumber: number, pinManager: PinManager, config: Desktop.Config) {

View File

@@ -1,14 +1,14 @@
function initWorkspaceSignalHandlers(world: World) {
const manager = new SignalManager();
manager.connect(workspace.clientAdded, (kwinClient: KwinClient) => {
manager.connect(Workspace.clientAdded, (kwinClient: KwinClient) => {
if (Clients.canTileEver(kwinClient)) {
// never open new tileable clients on all desktops or activities
if (kwinClient.desktop <= 0) {
kwinClient.desktop = workspace.currentDesktop;
kwinClient.desktop = Workspace.currentDesktop;
}
if (kwinClient.activities.length !== 1) {
kwinClient.activities = [workspace.currentActivity];
kwinClient.activities = [Workspace.currentActivity];
}
}
world.do((clientManager, desktopManager) => {
@@ -16,25 +16,25 @@ function initWorkspaceSignalHandlers(world: World) {
});
});
manager.connect(workspace.clientRemoved, (kwinClient: KwinClient) => {
manager.connect(Workspace.clientRemoved, (kwinClient: KwinClient) => {
world.do((clientManager, desktopManager) => {
clientManager.removeClient(kwinClient, true);
});
});
manager.connect(workspace.clientMinimized, (kwinClient: KwinClient) => {
manager.connect(Workspace.clientMinimized, (kwinClient: KwinClient) => {
world.do((clientManager, desktopManager) => {
clientManager.minimizeClient(kwinClient);
});
});
manager.connect(workspace.clientUnminimized, (kwinClient: KwinClient) => {
manager.connect(Workspace.clientUnminimized, (kwinClient: KwinClient) => {
world.do((clientManager, desktopManager) => {
clientManager.unminimizeClient(kwinClient);
});
});
manager.connect(workspace.clientMaximizeSet, (kwinClient: KwinClient, horizontally: boolean, vertically: boolean) => {
manager.connect(Workspace.clientMaximizeSet, (kwinClient: KwinClient, horizontally: boolean, vertically: boolean) => {
if ((horizontally || vertically) && kwinClient.tile !== null) {
kwinClient.tile = null;
}
@@ -43,7 +43,7 @@ function initWorkspaceSignalHandlers(world: World) {
});
});
manager.connect(workspace.clientActivated, (kwinClient: KwinClient) => {
manager.connect(Workspace.clientActivated, (kwinClient: KwinClient) => {
if (kwinClient === null) {
return;
}
@@ -52,19 +52,19 @@ function initWorkspaceSignalHandlers(world: World) {
});
});
manager.connect(workspace.currentDesktopChanged, () => {
manager.connect(Workspace.currentDesktopChanged, () => {
world.do(() => {}); // re-arrange desktop
});
manager.connect(workspace.currentActivityChanged, () => {
manager.connect(Workspace.currentActivityChanged, () => {
world.do(() => {}); // re-arrange desktop
});
manager.connect(workspace.numberDesktopsChanged, () => {
manager.connect(Workspace.numberDesktopsChanged, () => {
world.updateDesktops();
});
manager.connect(workspace.virtualScreenSizeChanged, () => {
manager.connect(Workspace.virtualScreenSizeChanged, () => {
world.onScreenResized();
});

View File

@@ -69,11 +69,11 @@ class ClientWrapper {
}
public focus() {
workspace.activeClient = this.kwinClient;
Workspace.activeClient = this.kwinClient;
}
public isFocused() {
return workspace.activeClient === this.kwinClient;
return Workspace.activeClient === this.kwinClient;
}
public setMaximize(horizontally: boolean, vertically: boolean) {
@@ -124,7 +124,7 @@ class ClientWrapper {
}
public ensureVisible(screenSize: QmlRect) {
if (this.kwinClient.desktop !== workspace.currentDesktop) {
if (this.kwinClient.desktop !== Workspace.currentDesktop) {
return;
}
const frame = this.kwinClient.frameGeometry;

View File

@@ -12,20 +12,20 @@ namespace Clients {
kwinClient.minimized = false;
}
if (kwinClient.desktop <= 0) {
kwinClient.desktop = workspace.currentDesktop;
kwinClient.desktop = Workspace.currentDesktop;
}
if (kwinClient.activities.length !== 1) {
kwinClient.activities = [workspace.currentActivity];
kwinClient.activities = [Workspace.currentActivity];
}
}
export function isMaximizedGeometry(kwinClient: KwinClient) {
const maximizeArea = workspace.clientArea(ClientAreaOption.MaximizeArea, kwinClient.screen, kwinClient.desktop);
const maximizeArea = Workspace.clientArea(ClientAreaOption.MaximizeArea, kwinClient.screen, kwinClient.desktop);
return kwinClient.frameGeometry === maximizeArea;
}
export function isFullScreenGeometry(kwinClient: KwinClient) {
const fullScreenArea = workspace.clientArea(ClientAreaOption.FullScreenArea, kwinClient.screen, kwinClient.desktop);
const fullScreenArea = Workspace.clientArea(ClientAreaOption.FullScreenArea, kwinClient.screen, kwinClient.desktop);
return kwinClient.frameGeometry === fullScreenArea;
}

View File

@@ -16,7 +16,7 @@ class DesktopManager {
}
public update() {
this.setNVirtualDesktops(workspace.desktops);
this.setNVirtualDesktops(Workspace.desktops);
}
public getDesktop(activity: string, desktopNumber: number) {
@@ -31,11 +31,11 @@ class DesktopManager {
}
public getCurrentDesktop() {
return this.getDesktop(workspace.currentActivity, workspace.currentDesktop);
return this.getDesktop(Workspace.currentActivity, Workspace.currentDesktop);
}
public getDesktopInCurrentActivity(desktopNumber: number) {
return this.getDesktop(workspace.currentActivity, desktopNumber);
return this.getDesktop(Workspace.currentActivity, desktopNumber);
}
public getDesktopForClient(kwinClient: KwinClient) {

View File

@@ -11,7 +11,7 @@ class World {
this.workspaceSignalManager = initWorkspaceSignalHandlers(this);
this.screenResizedDelayer = new Delayer(1000, () => {
// this delay ensures that docks are taken into account by `workspace.clientArea`
// this delay ensures that docks are taken into account by `Workspace.clientArea`
const desktopManager = this.desktopManager; // workaround for bug in Qt5's JS engine
for (const desktop of desktopManager.desktops()) {
desktop.onLayoutChanged();
@@ -47,7 +47,7 @@ class World {
clamper: config.scrollingLazy ? new EdgeClamper() : new CenterClamper(),
},
layoutConfig,
workspace.currentActivity,
Workspace.currentActivity,
);
this.clientManager = new ClientManager(config, this, this.desktopManager, this.pinManager);
this.addExistingClients();
@@ -55,7 +55,7 @@ class World {
}
private addExistingClients() {
const kwinClients = workspace.clientList();
const kwinClients = Workspace.clientList();
for (let i = 0; i < kwinClients.length; i++) {
const kwinClient = kwinClients[i];
this.clientManager.addClient(kwinClient);
@@ -94,7 +94,7 @@ class World {
followTransient: boolean,
f: (clientManager: ClientManager, desktopManager: DesktopManager, window: Window, column: Column, grid: Grid) => void,
) {
this.doIfTiled(workspace.activeClient, followTransient, f);
this.doIfTiled(Workspace.activeClient, followTransient, f);
}
public destroy() {

View File

@@ -24,7 +24,7 @@ namespace ClientState {
}
private static limitHeight(client: ClientWrapper) {
const placementArea = workspace.clientArea(ClientAreaOption.PlacementArea, client.kwinClient.screen, client.kwinClient.desktop);
const placementArea = Workspace.clientArea(ClientAreaOption.PlacementArea, client.kwinClient.screen, client.kwinClient.desktop);
const clientRect = client.kwinClient.frameGeometry;
const width = client.preferredWidth;
client.place(