Skip to content

Commit

Permalink
Improve heartbeat activity detection on onDidChangeWindowState event
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Jul 10, 2024
1 parent 2f9e676 commit bfbce28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Gitpod",
"description": "Gitpod Support",
"publisher": "gitpod",
"version": "0.0.168",
"version": "0.0.169",
"license": "MIT",
"icon": "resources/gitpod.png",
"repository": {
Expand Down
9 changes: 7 additions & 2 deletions src/heartbeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ export class HeartbeatManager extends Disposable {
this._register(vscode.window.onDidCloseTerminal(() => this.updateLastActivity('onDidCloseTerminal')));
this._register(vscode.window.onDidChangeTerminalState(() => this.updateLastActivity('onDidChangeTerminalState')));
this._register(vscode.window.onDidChangeWindowState((e) => {
this.focused = e.focused;
this.updateLastActivity('onDidChangeWindowState');
// active property was introduced in 1.89, but not exist in 1.75
// https://code.visualstudio.com/api/references/vscode-api#WindowState
const isActive: Boolean | undefined = (e as any).active;
if (isActive === true || e.focused !== this.focused) {
this.focused = e.focused;
this.updateLastActivity('onDidChangeWindowState');
}
}));
this._register(vscode.window.onDidChangeActiveColorTheme(() => this.updateLastActivity('onDidChangeActiveColorTheme')));
this._register(vscode.authentication.onDidChangeSessions(() => this.updateLastActivity('onDidChangeSessions')));
Expand Down

0 comments on commit bfbce28

Please sign in to comment.