Skip to content

Commit

Permalink
ok now it works (thank you fptje)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroxoneafour committed Feb 24, 2024
1 parent e5f8f86 commit 211dfd5
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 32 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"esbuild": "^0.19.4",
"eslint": "^8.51.0",
"fast-copy": "^3.0.1",
"kwin-api": "^6.0.7",
"kwin-api": "^6.0.8",
"mnemonist": "^0.39.5",
"prettier": "3.2.5",
"typescript": "^5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion src/controller/actions/windowhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class WindowHooks {

this.ctrl.driverManager.rebuildLayout(this.window.output);

// TODO - Add cleanup for timer (timer.destroy())
timer.destroy();
}

putWindowInBestTile(): void {
Expand Down
7 changes: 4 additions & 3 deletions src/controller/desktop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// desktop.ts - Classes and interfaces relating to the desktop class

import { Output, QmlWorkspace, VirtualDesktop, Window } from "kwin-api";
import { Output, VirtualDesktop, Window } from "kwin-api";
import { Workspace } from "kwin-api/qml";

export interface StringDesktop {
desktop: string; // VirtualDesktop.id
Expand Down Expand Up @@ -47,11 +48,11 @@ export class Desktop {
}

export class DesktopFactory {
private workspace: QmlWorkspace;
private workspace: Workspace;
private desktopMap: Map<string, VirtualDesktop> = new Map();
private outputMap: Map<string, Output> = new Map();

public constructor(workspace: QmlWorkspace) {
public constructor(workspace: Workspace) {
this.workspace = workspace;
this.desktopsChanged();
this.screensChanged();
Expand Down
15 changes: 8 additions & 7 deletions src/controller/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// controller.ts - Main controller object of the script

import * as Kwin from "kwin-api";
import * as Qml from "kwin-api";
import { Options, Tile, Window } from "kwin-api";
import { Workspace, KWin } from "kwin-api/qml";
import * as Qml from "../extern/qml";

import { Log } from "../util/log";
import { Config } from "../util/config";
Expand All @@ -16,9 +17,9 @@ import { WindowHookManager } from "./actions/windowhooks";
import { SettingsDialogManager } from "./actions/settingsdialog";

export class Controller {
workspace: Kwin.QmlWorkspace;
options: Kwin.Options;
kwinApi: Kwin.QmlKWin;
workspace: Workspace;
options: Options;
kwinApi: KWin;
qmlObjects: Qml.Objects;

desktopFactory: DesktopFactory;
Expand All @@ -33,8 +34,8 @@ export class Controller {
config: Config;

workspaceExtensions: WorkspaceExtensions;
windowExtensions: Map<Kwin.Window, WindowExtensions> = new Map();
managedTiles: Set<Kwin.Tile> = new Set();
windowExtensions: Map<Window, WindowExtensions> = new Map();
managedTiles: Set<Tile> = new Set();

constructor(qmlApi: Qml.Api, qmlObjects: Qml.Objects) {
this.workspace = qmlApi.workspace;
Expand Down
10 changes: 8 additions & 2 deletions src/driver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export class DriverManager {
desktopString,
);
let engineType = this.config.engineType;
const engine = this.engineFactory.newEngine(engineType);
const config: EngineConfig = {
engineType: engineType,
insertionPoint: this.config.insertionPoint,
rotateLayout: this.config.rotateLayout
}
const engine = this.engineFactory.newEngine(config);
const driver = new TilingDriver(engine, engineType, this.ctrl);
this.drivers.set(desktopString, driver);
this.ctrl.dbusManager.getSettings(
Expand All @@ -75,7 +80,8 @@ export class DriverManager {
break;
}
}
if (remove && this.rootTileCallbacks.get(tile)) {
if (remove && this.rootTileCallbacks.has(tile)) {
this.rootTileCallbacks.get(tile)!.destroy();
this.rootTileCallbacks.delete(tile);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/engine/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import { Direction } from "../util/geometry";
import { InsertionPoint } from "../util/config";
import { LayoutDirection, QSize, Window } from "kwin-api";
import { LayoutDirection } from "kwin-api";
import { QSize } from "kwin-api/qt";
import { Client as IClient, Tile as ITile, TilingEngine as ITilingEngine } from "./index";

export interface EngineConfig {
Expand Down
3 changes: 2 additions & 1 deletion src/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import { Config } from "../util/config";
import { Direction } from "../util/geometry";
import { LayoutDirection, QSize, Window } from "kwin-api";
import { LayoutDirection, Window } from "kwin-api";
import { QSize } from "kwin-api/qt";
import {
EngineCapability,
EngineConfig as InternalEngineConfig,
Expand Down
19 changes: 8 additions & 11 deletions src/extern/qml.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
// qml.d.ts - Declarations for external QML methods

import {
QmlWorkspace as Workspace,
Options,
QmlKWin as KwinApi,
DBusCall,
Signal, ShortcutHandler
} from "kwin-api";
import { QTimer } from "kwin-api";
import { Options } from "kwin-api";
import { Signal, QTimer } from "kwin-api/qt";
import { Workspace, KWin, DBusCall, ShortcutHandler } from "kwin-api/qml";
import { EngineConfig } from "../engine";
import { StringDesktop } from "../controller/desktop";

export interface Api {
workspace: Workspace;
options: Options;
kwin: KwinApi;
kwin: KWin;
}

export interface Objects {
Expand All @@ -35,7 +30,9 @@ export interface Settings {
hide(): void;
saveAndHide(): void;
setSettings(s: EngineConfig): void;
saveSettings: Signal<(settings: EngineConfig, desktop: StringDesktop) => void>;
saveSettings: Signal<
(settings: EngineConfig, desktop: StringDesktop) => void
>;
removeSettings: Signal<(desktop: StringDesktop) => void>;
}

Expand All @@ -49,4 +46,4 @@ export interface DBus {
setSettings: DBusCall;
removeSettings: DBusCall;
exists: DBusCall;
}
}
2 changes: 1 addition & 1 deletion src/util/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// config.ts - Static config class

import { EngineType } from "../engine";
import { QmlKWin } from "kwin-api";
import { KWin } from "kwin-api/qml";

export const enum InsertionPoint {
Left = 0,
Expand Down

0 comments on commit 211dfd5

Please sign in to comment.