mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-08-14 18:40:35 +03:00
feat: use better layout notifications
This commit is contained in:
parent
2862e56194
commit
8c013ac7bc
@ -164,6 +164,12 @@ export interface Engine {
|
||||
* @param text the text of the notification
|
||||
*/
|
||||
showNotification(text: string): void;
|
||||
|
||||
/**
|
||||
* Show the notification with the info
|
||||
* about the current layout.
|
||||
*/
|
||||
showLayoutNotification(): void;
|
||||
}
|
||||
|
||||
export class EngineImpl implements Engine {
|
||||
@ -566,7 +572,7 @@ export class EngineImpl implements Engine {
|
||||
step
|
||||
);
|
||||
if (layout) {
|
||||
this.controller.showNotification(layout.description);
|
||||
this.showLayoutNotification();
|
||||
|
||||
// Minimize inactive windows if Monocle and config.monocleMinimizeRest
|
||||
if (
|
||||
@ -584,7 +590,7 @@ export class EngineImpl implements Engine {
|
||||
layoutClassID
|
||||
);
|
||||
if (layout) {
|
||||
this.controller.showNotification(layout.description);
|
||||
this.showLayoutNotification();
|
||||
|
||||
// Minimize inactive windows if Monocle and config.monocleMinimizeRest
|
||||
if (
|
||||
@ -695,6 +701,11 @@ export class EngineImpl implements Engine {
|
||||
this.controller.showNotification(text);
|
||||
}
|
||||
|
||||
public showLayoutNotification(): void {
|
||||
const currentLayout = this.currentLayoutOnCurrentSurface();
|
||||
this.controller.showNotification(`Layout: ${currentLayout.description}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tiling area for the given working area and the windows layout.
|
||||
*
|
||||
|
@ -58,7 +58,7 @@ export default class CascadeLayout implements WindowsLayout {
|
||||
public readonly classID = CascadeLayout.id;
|
||||
|
||||
public get description(): string {
|
||||
return "Cascade [" + CascadeDirection[this.dir] + "]";
|
||||
return `Cascade [${CascadeDirection[this.dir]}]`;
|
||||
}
|
||||
|
||||
constructor(private dir: CascadeDirection = CascadeDirection.SouthEast) {
|
||||
@ -105,10 +105,10 @@ export default class CascadeLayout implements WindowsLayout {
|
||||
public executeAction(engine: Engine, action: Action): void {
|
||||
if (action instanceof IncreaseMasterAreaWindowCount) {
|
||||
this.dir = (this.dir + 1 + 8) % 8;
|
||||
engine.showNotification(this.description);
|
||||
engine.showLayoutNotification();
|
||||
} else if (action instanceof DecreaseMasterAreaWindowCount) {
|
||||
this.dir = (this.dir - 1 + 8) % 8;
|
||||
engine.showNotification(this.description);
|
||||
engine.showLayoutNotification();
|
||||
} else {
|
||||
action.executeWithoutLayoutOverride();
|
||||
}
|
||||
|
@ -239,6 +239,6 @@ export default class ThreeColumnLayout implements WindowsLayout {
|
||||
|
||||
private resizeMaster(engine: Engine, step: -1 | 1): void {
|
||||
this.masterSize = clip(this.masterSize + step, 1, 10);
|
||||
engine.showNotification(this.description);
|
||||
engine.showLayoutNotification();
|
||||
}
|
||||
}
|
||||
|
@ -124,12 +124,12 @@ export default class TileLayout implements WindowsLayout {
|
||||
if (this.numMaster < 10) {
|
||||
this.numMaster += 1;
|
||||
}
|
||||
engine.showNotification(this.description);
|
||||
engine.showLayoutNotification();
|
||||
} else if (action instanceof DecreaseMasterAreaWindowCount) {
|
||||
if (this.numMaster > 0) {
|
||||
this.numMaster -= 1;
|
||||
}
|
||||
engine.showNotification(this.description);
|
||||
engine.showLayoutNotification();
|
||||
} else if (action instanceof Rotate) {
|
||||
this.parts.rotate(90);
|
||||
} else if (action instanceof RotatePart) {
|
||||
|
Loading…
Reference in New Issue
Block a user