Skip to content

Commit cec7457

Browse files
committed
Track window focus in heartbeat telemetry
1 parent 11f6848 commit cec7457

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/heartbeat.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export class HeartbeatManager extends Disposable {
4343
totalCount: 0,
4444
};
4545

46+
private focused = true;
47+
4648
constructor(
4749
private readonly connectionInfo: SSHConnectionParams,
4850
private readonly workspaceState: WorkspaceState | undefined,
@@ -73,7 +75,10 @@ export class HeartbeatManager extends Disposable {
7375
this._register(vscode.window.onDidOpenTerminal(() => this.updateLastActivity('onDidOpenTerminal')));
7476
this._register(vscode.window.onDidCloseTerminal(() => this.updateLastActivity('onDidCloseTerminal')));
7577
this._register(vscode.window.onDidChangeTerminalState(() => this.updateLastActivity('onDidChangeTerminalState')));
76-
this._register(vscode.window.onDidChangeWindowState(() => this.updateLastActivity('onDidChangeWindowState')));
78+
this._register(vscode.window.onDidChangeWindowState((e) => {
79+
this.focused = e.focused;
80+
this.updateLastActivity('onDidChangeWindowState');
81+
}));
7782
this._register(vscode.window.onDidChangeActiveColorTheme(() => this.updateLastActivity('onDidChangeActiveColorTheme')));
7883
this._register(vscode.authentication.onDidChangeSessions(() => this.updateLastActivity('onDidChangeSessions')));
7984
this._register(vscode.debug.onDidChangeActiveDebugSession(() => this.updateLastActivity('onDidChangeActiveDebugSession')));
@@ -216,6 +221,8 @@ export class HeartbeatManager extends Disposable {
216221
clientKind: 'vscode-desktop',
217222
debugWorkspace: String(!!this.connectionInfo.debugWorkspace),
218223
delta: Object.fromEntries(this.eventCounterMap),
224+
focused: this.focused,
225+
publicApi: !!this.workspaceState
219226
} as IDEHeartbeatTelemetryData);
220227

221228
this.eventCounterMap.clear();

0 commit comments

Comments
 (0)