Skip to content

Commit

Permalink
Support Microsoft apps
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Sep 18, 2024
1 parent 0ed42c3 commit b85c8d3
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 10 deletions.
21 changes: 16 additions & 5 deletions electron/helpers/monitored-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@ export class MonitoredApp {
app?: AppData,
): HeartbeatData | null {
const entity = this.entity(windowInfo, app);
const category = app ? this.category(app) : null;
const language = app ? this.language(app) : null;
const project = this.project(windowInfo);
if (!entity) {
return null;
}
const category = this.category(app);
const language = this.language(app);
const project = this.project(windowInfo);
return {
entity,
category,
language,
project,
};
}
static category(app: AppData): Category | null {
static category(app?: AppData): Category | null {
if (!app) {
return null;
}

switch (app.id) {
case "arcbrowser":
case "brave":
Expand All @@ -42,12 +46,14 @@ export class MonitoredApp {
return "browsing";

case "imessage":
case "microsoft_outlook":
case "slack":
case "wecom":
return "communicating";

case "iterm2":
case "mac_terminal":
case "microsoft_excel":
case "windows_terminal":
case "powershell":
case "warp":
Expand All @@ -58,6 +64,7 @@ export class MonitoredApp {
case "tableplus":
return "debugging";

case "microsoft_word":
case "notes":
case "notion":
return "writing docs";
Expand All @@ -73,7 +80,11 @@ export class MonitoredApp {
return null;
}
}
static language(app: AppData) {
static language(app?: AppData) {
if (!app) {
return null;
}

switch (app.id) {
case "canva":
case "figma":
Expand Down
16 changes: 11 additions & 5 deletions electron/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type Category =
| "writing docs"
| "writing tests";

export type EntityType = "file" | "app";
export type EntityType = "file" | "app" | "url" | "domain";

export type MonitoredApp =
| "arcbrowser"
Expand All @@ -28,21 +28,27 @@ export type MonitoredApp =
| "firefox"
| "imessage"
| "iterm2"
| "powershell"
| "linear"
| "mac_terminal"
| "microsoft_access"
| "microsoft_edge"
| "microsoft_excel"
| "microsoft_outlook"
| "microsoft_onenote"
| "microsoft_powerpoint"
| "microsoft_word"
| "notes"
| "notion"
| "postman"
| "powershell"
| "safari"
| "safaripreview"
| "microsoft_edge"
| "slack"
| "tableplus"
| "mac_terminal"
| "windows_terminal"
| "warp"
| "wecom"
| "whatsapp"
| "windows_terminal"
| "xcode"
| "zoom";

Expand Down
48 changes: 48 additions & 0 deletions electron/watchers/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,54 @@ export const allApps: MonitoredAppInfo[] = [
},
isDefaultEnabled: true,
},
{
id: "microsoft_access",
windows: {
exePath: "MSACCESS.exe",
DisplayName: "Microsoft Access",
},
isDefaultEnabled: true,
},
{
id: "microsoft_excel",
windows: {
exePath: "EXCEL.exe",
DisplayName: "Microsoft Excel",
},
isDefaultEnabled: true,
},
{
id: "microsoft_onenote",
windows: {
exePath: "ONENOTE.exe",
DisplayName: "Microsoft OneNote",
},
isDefaultEnabled: true,
},
{
id: "microsoft_outlook",
windows: {
exePath: "OUTLOOK.exe",
DisplayName: "Microsoft Outlook",
},
isDefaultEnabled: true,
},
{
id: "microsoft_powerpoint",
windows: {
exePath: "POWERPNT.exe",
DisplayName: "Microsoft PowerPoint",
},
isDefaultEnabled: true,
},
{
id: "microsoft_word",
windows: {
exePath: "WINWORD.exe",
DisplayName: "Microsoft Word",
},
isDefaultEnabled: true,
},
{
id: "notes",
mac: {
Expand Down

0 comments on commit b85c8d3

Please sign in to comment.