diff --git a/src/Actions.ts b/src/Actions.ts index 3fb63d4..20a1cf8 100644 --- a/src/Actions.ts +++ b/src/Actions.ts @@ -43,7 +43,7 @@ module Actions { focusStart: () => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const firstColumn = grid.getFirstColumn(); if (firstColumn === null) { return; @@ -54,7 +54,7 @@ module Actions { focusEnd: () => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const lastColumn = grid.getLastColumn(); if (lastColumn === null) { return; @@ -186,7 +186,7 @@ module Actions { gridScrollStart: () => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const firstColumn = grid.getFirstColumn(); if (firstColumn === null) { return; @@ -197,7 +197,7 @@ module Actions { gridScrollEnd: () => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const lastColumn = grid.getLastColumn(); if (lastColumn === null) { return; @@ -214,7 +214,7 @@ module Actions { gridScrollLeftColumn: () => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const column = grid.getLeftmostVisibleColumn(grid.container.getCurrentScrollPos(), true); if (column === null) { return; @@ -231,7 +231,7 @@ module Actions { gridScrollRightColumn: () => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const column = grid.getRightmostVisibleColumn(grid.container.getCurrentScrollPos(), true); if (column === null) { return; @@ -252,7 +252,7 @@ module Actions { return { focusColumn: (columnIndex: number) => { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; const targetColumn = grid.getColumnAtIndex(columnIndex); if (targetColumn === null) { return null; @@ -289,7 +289,7 @@ module Actions { columnMoveToDesktop: (desktopIndex: number) => { world.doIfTiledFocused(true, (clientManager, desktopManager, window, column, oldGrid) => { const desktopNumber = desktopIndex + 1; - const newGrid = desktopManager.getInCurrentActivity(desktopNumber).grid; + const newGrid = desktopManager.getDesktopInCurrentActivity(desktopNumber).grid; if (newGrid === null || newGrid === oldGrid) { return; } @@ -300,7 +300,7 @@ module Actions { tailMoveToDesktop: (desktopIndex: number) => { world.doIfTiledFocused(true, (clientManager, desktopManager, window, column, oldGrid) => { const desktopNumber = desktopIndex + 1; - const newGrid = desktopManager.getInCurrentActivity(desktopNumber).grid; + const newGrid = desktopManager.getDesktopInCurrentActivity(desktopNumber).grid; if (newGrid === null || newGrid === oldGrid) { return; } @@ -312,7 +312,7 @@ module Actions { function gridScroll(world: World, amount: number) { world.do((clientManager, desktopManager) => { - const grid = desktopManager.getCurrent().grid; + const grid = desktopManager.getCurrentDesktop().grid; grid.container.adjustScroll(amount, false); }); } diff --git a/src/world/ClientManager.ts b/src/world/ClientManager.ts index bb7ffc8..408059a 100644 --- a/src/world/ClientManager.ts +++ b/src/world/ClientManager.ts @@ -33,7 +33,7 @@ class ClientManager { if (kwinClient.dock) { client.stateManager.setState(new ClientStateDocked(this.world, kwinClient), false); } else if (this.windowRuleEnforcer.shouldTile(kwinClient)) { - const grid = this.desktopManager.getForClient(client.kwinClient).grid; + const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid; client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false); } } @@ -77,7 +77,7 @@ class ClientManager { return; } if (client.stateManager.getState() instanceof ClientStateTiledMinimized) { - const grid = this.desktopManager.getForClient(client.kwinClient).grid; + const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid; client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false); } } @@ -90,7 +90,7 @@ class ClientManager { if (client.stateManager.getState() instanceof ClientStateTiled) { return; } - const grid = this.desktopManager.getForClient(client.kwinClient).grid; + const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid; client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false); } @@ -113,7 +113,7 @@ class ClientManager { const clientState = client.stateManager.getState(); if (clientState instanceof ClientStateFloating && Clients.canTileEver(kwinClient)) { Clients.makeTileable(kwinClient); - const grid = this.desktopManager.getForClient(client.kwinClient).grid; + const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid; client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false); } else if (clientState instanceof ClientStateTiled) { client.stateManager.setState(new ClientStateFloating(), false); diff --git a/src/world/ClientStateTiled.ts b/src/world/ClientStateTiled.ts index 381722a..b1cb19c 100644 --- a/src/world/ClientStateTiled.ts +++ b/src/world/ClientStateTiled.ts @@ -99,7 +99,7 @@ class ClientStateTiled { const kwinClient = window.client.kwinClient; const oldGrid = window.column.grid; - const newGrid = desktopManager.getForClient(kwinClient).grid; + const newGrid = desktopManager.getDesktopForClient(kwinClient).grid; if (oldGrid === newGrid) { // window already on the correct grid return; diff --git a/src/world/DesktopManager.ts b/src/world/DesktopManager.ts index 2649ec6..4883ad6 100644 --- a/src/world/DesktopManager.ts +++ b/src/world/DesktopManager.ts @@ -17,7 +17,7 @@ class DesktopManager { this.setNVirtualDesktops(workspace.desktops); } - public get(activity: string, desktopNumber: number) { + public getDesktop(activity: string, desktopNumber: number) { const desktopIndex = desktopNumber - 1; if (desktopIndex >= this.nVirtualDesktops || this.nVirtualDesktops < 0) { throw new Error("invalid desktop number: " + String(desktopNumber)); @@ -28,17 +28,17 @@ class DesktopManager { return this.desktopsPerActivity.get(activity)![desktopIndex]; } - public getCurrent() { - return this.get(workspace.currentActivity, workspace.currentDesktop); + public getCurrentDesktop() { + return this.getDesktop(workspace.currentActivity, workspace.currentDesktop); } - public getInCurrentActivity(desktopNumber: number) { - return this.get(workspace.currentActivity, desktopNumber); + public getDesktopInCurrentActivity(desktopNumber: number) { + return this.getDesktop(workspace.currentActivity, desktopNumber); } - public getForClient(kwinClient: AbstractClient) { + public getDesktopForClient(kwinClient: AbstractClient) { console.assert(kwinClient.activities.length === 1); - return this.get(kwinClient.activities[0], kwinClient.desktop); + return this.getDesktop(kwinClient.activities[0], kwinClient.desktop); } private setNVirtualDesktops(nVirtualDesktops: number) { diff --git a/src/world/World.ts b/src/world/World.ts index bd76754..ed0fa1c 100644 --- a/src/world/World.ts +++ b/src/world/World.ts @@ -47,7 +47,7 @@ class World { } public update() { - this.desktopManager.getCurrent().arrange(); + this.desktopManager.getCurrentDesktop().arrange(); } public do(f: (clientManager: ClientManager, desktopManager: DesktopManager) => void) {