From b34e8474e414981d67d35883b5f4e27f1974683f Mon Sep 17 00:00:00 2001 From: "Eon S. Jeon" Date: Fri, 29 Mar 2019 23:57:22 +0900 Subject: [PATCH] make `shouldIgnore/Float` into properties --- src/architecture.ts | 4 ++-- src/driver/kwin/kwinwindow.ts | 44 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/architecture.ts b/src/architecture.ts index 121ef87..401892e 100644 --- a/src/architecture.ts +++ b/src/architecture.ts @@ -79,10 +79,10 @@ interface IDriverWindow { readonly fullScreen: boolean; readonly geometry: Rect; readonly id: string; + readonly shouldIgnore: boolean; + readonly shouldFloat: boolean; commit(geometry?: Rect, noBorder?: boolean, keepBelow?: boolean): void; - shouldIgnore(): boolean; - shouldFloat(): boolean; visible(ctx: IDriverContext): boolean; } diff --git a/src/driver/kwin/kwinwindow.ts b/src/driver/kwin/kwinwindow.ts index 55c4215..d2f48ca 100644 --- a/src/driver/kwin/kwinwindow.ts +++ b/src/driver/kwin/kwinwindow.ts @@ -50,6 +50,28 @@ class KWinWindow implements IDriverWindow { return toRect(this.client.geometry); } + public get shouldIgnore(): boolean { + const resourceClass = String(this.client.resourceClass); + return ( + this.client.specialWindow + || resourceClass === "plasmashell" + || (KWINCONFIG.ignoreClass.indexOf(resourceClass) >= 0) + || (matchWords(this.client.caption, KWINCONFIG.ignoreTitle) >= 0) + ); + } + + public get shouldFloat(): boolean { + const resourceClass = String(this.client.resourceClass); + return ( + this.client.modal + || (!this.client.resizeable) + || (KWINCONFIG.floatUtility + && (this.client.dialog || this.client.splash || this.client.utility)) + || (KWINCONFIG.floatingClass.indexOf(resourceClass) >= 0) + || (matchWords(this.client.caption, KWINCONFIG.floatingTitle) >= 0) + ); + } + private readonly _bakNoBorder: boolean; constructor(client: KWin.Client) { @@ -72,28 +94,6 @@ class KWinWindow implements IDriverWindow { this.client.geometry = toQRect(this.adjustGeometry(geometry)); } - public shouldIgnore(): boolean { - const resourceClass = String(this.client.resourceClass); - return ( - this.client.specialWindow - || resourceClass === "plasmashell" - || (KWINCONFIG.ignoreClass.indexOf(resourceClass) >= 0) - || (matchWords(this.client.caption, KWINCONFIG.ignoreTitle) >= 0) - ); - } - - public shouldFloat(): boolean { - const resourceClass = String(this.client.resourceClass); - return ( - this.client.modal - || (!this.client.resizeable) - || (KWINCONFIG.floatUtility - && (this.client.dialog || this.client.splash || this.client.utility)) - || (KWINCONFIG.floatingClass.indexOf(resourceClass) >= 0) - || (matchWords(this.client.caption, KWINCONFIG.floatingTitle) >= 0) - ); - } - public toString(): string { /* using a shorthand name to keep debug message tidy */ return "KWin(" + this.client.windowId.toString(16) + "." + this.client.resourceClass + ")";