Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ Currently VS Code extensions don't support getting file/project names for non-ed

This extension requires ActivityWatch to be running on your machine.

## VS Code-compatible editors

When this extension runs in VS Code-compatible editors, it uses a distinct
ActivityWatch client and bucket name for each known editor so their activity
streams do not overlap:

- VS Code: `aw-watcher-vscode`
- VSCodium: `aw-watcher-vscodium`
- Cursor: `aw-watcher-cursor`
- Antigravity: `aw-watcher-antigravity`

## Install Instructions

To install this extension, search for aw-watcher-vscode in the Extensions sidebar in VS Code, and install the one with ActivityWatch as the publisher name. And that's it, if Activity Watch was running, it should detect this vs-code watcher automatically. Give it some time to have some data to display and it should show in the ActivityWatch Timeline and Activity sections soon.
Expand Down
20 changes: 18 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the necessary extensibility types to use in your code below
import { Disposable, ExtensionContext, commands, window, workspace, Uri, Extension, extensions } from 'vscode';
import { Disposable, ExtensionContext, commands, window, workspace, Uri, Extension, extensions, env } from 'vscode';
import { AWClient, IAppEditorEvent } from '../aw-client-js/src/aw-client';
import { hostname } from 'os';
import { API, GitExtension } from './git';
Expand All @@ -20,6 +20,22 @@ export function activate(context: ExtensionContext) {
context.subscriptions.push(reloadCommand);
}

function activityWatchClientName(): string {
const appName = env.appName.toLowerCase();

if (appName.includes('cursor')) {
return 'aw-watcher-cursor';
}
if (appName.includes('antigravity')) {
return 'aw-watcher-antigravity';
}
if (appName.includes('codium')) {
return 'aw-watcher-vscodium';
}

return 'aw-watcher-vscode';
}

class ActivityWatch {
private _disposable: Disposable;
private _client: AWClient;
Expand All @@ -45,7 +61,7 @@ class ActivityWatch {
this._bucket = {
id: '',
hostName: hostname(),
clientName: 'aw-watcher-vscode',
clientName: activityWatchClientName(),
eventType: 'app.editor.activity'
};
this._bucket.id = `${this._bucket.clientName}_${this._bucket.hostName}`;
Expand Down
Loading