mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-11-04 13:37:43 +03:00
docs: add JSDoc to the Driver
This commit is contained in:
parent
2ed3cb4499
commit
cb97128cf0
@ -17,26 +17,49 @@ import { WindowState } from "../engine/window";
|
|||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import { Log } from "../util/log";
|
import { Log } from "../util/log";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides convenient interface to KWin functions.
|
||||||
|
* Hides all the bad and ugly things current KWin has.
|
||||||
|
*/
|
||||||
export interface Driver {
|
export interface Driver {
|
||||||
|
/**
|
||||||
|
* All the surfaces/screens currently possess by the KWin
|
||||||
|
*/
|
||||||
readonly screens: DriverSurface[];
|
readonly screens: DriverSurface[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Surface (screen) of the current window
|
||||||
|
*/
|
||||||
currentSurface: DriverSurface;
|
currentSurface: DriverSurface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currently active (i.e. focused) window
|
||||||
|
*/
|
||||||
currentWindow: EngineWindow | null;
|
currentWindow: EngineWindow | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show notification to the user
|
||||||
|
* @param text notification text
|
||||||
|
*/
|
||||||
showNotification(text: string): void;
|
showNotification(text: string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind script to the various KWin events
|
||||||
|
*/
|
||||||
bindEvents(): void;
|
bindEvents(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind the shortcut for the action
|
||||||
|
* @param action
|
||||||
|
*/
|
||||||
bindShortcut(action: Action): void;
|
bindShortcut(action: Action): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage the windows, that were active before script loading
|
||||||
|
*/
|
||||||
manageWindows(): void;
|
manageWindows(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Abstracts KDE implementation specific details.
|
|
||||||
*
|
|
||||||
* Driver is responsible for initializing the tiling logic, connecting
|
|
||||||
* signals (Qt/KDE term for binding events), and providing specific utility
|
|
||||||
* functions.
|
|
||||||
*/
|
|
||||||
export class DriverImpl implements Driver {
|
export class DriverImpl implements Driver {
|
||||||
public get currentSurface(): DriverSurface {
|
public get currentSurface(): DriverSurface {
|
||||||
return new DriverSurfaceImpl(
|
return new DriverSurfaceImpl(
|
||||||
@ -143,9 +166,6 @@ export class DriverImpl implements Driver {
|
|||||||
this.kwinApi = kwinApi;
|
this.kwinApi = kwinApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Bind script to the various KWin events
|
|
||||||
*/
|
|
||||||
public bindEvents(): void {
|
public bindEvents(): void {
|
||||||
const onNumberScreensChanged = (count: number): void => {
|
const onNumberScreensChanged = (count: number): void => {
|
||||||
this.controller.onSurfaceUpdate(`screens=${count}`);
|
this.controller.onSurfaceUpdate(`screens=${count}`);
|
||||||
@ -268,9 +288,6 @@ export class DriverImpl implements Driver {
|
|||||||
* https://github.com/KDE/kwin/blob/master/scripts/minimizeall/contents/code/main.js */
|
* https://github.com/KDE/kwin/blob/master/scripts/minimizeall/contents/code/main.js */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Manage the windows
|
|
||||||
*/
|
|
||||||
public manageWindows(): void {
|
public manageWindows(): void {
|
||||||
const clients = this.kwinApi.workspace.clientList();
|
const clients = this.kwinApi.workspace.clientList();
|
||||||
// TODO: provide interface for using the "for of" cycle
|
// TODO: provide interface for using the "for of" cycle
|
||||||
|
Loading…
Reference in New Issue
Block a user