diff --git a/src/service/hyprland.ts b/src/service/hyprland.ts index fe6e2209..757c5f76 100644 --- a/src/service/hyprland.ts +++ b/src/service/hyprland.ts @@ -223,9 +223,7 @@ export class Hyprland extends Service { this._monitors.set(m.id, m); if (m.focused) { this._active.monitor.update(m.id, m.name); - this._active.workspace.update(m.activeWorkspace.id, m.activeWorkspace.name); this._active.monitor.emit('changed'); - this._active.workspace.emit('changed'); } } if (notify) @@ -235,6 +233,17 @@ export class Hyprland extends Service { } } + private _updateActiveWorksapce(id: number, name: string, notify = true) { + try { + this._active.workspace.update(id, name); + this._active.workspace.emit('changed'); + if (notify) + this.notify('workspaces'); + } catch (error) { + logError(error); + } + } + private async _syncWorkspaces(notify = true) { try { const msg = await this.messageAsync('j/workspaces'); @@ -272,7 +281,9 @@ export class Hyprland extends Service { try { switch (e) { - case 'workspace': + case 'workspacev2': + this._updateActiveWorksapce(Number(argv[0]), argv[1]); + break; case 'focusedmon': await this._syncMonitors(); break;