diff --git a/src/queries.ts b/src/queries.ts index 5fed7e17..10b51e6d 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -289,7 +289,12 @@ function browsersWithBuckets(browserbuckets: string[]): [string, string][] { // The full set of historical app names these patterns replace is documented in the unit tests. // See: test/unit/queries.test.node.ts, https://github.com/ActivityWatch/aw-webui/issues/749 export const browser_appname_regex: Record = { - chrome: '(?i)^(google[-_ ]?chrome|chrome|chromium)', + // Chromium forks (Arc, Dia) run the chrome build of the extension, which announces itself + // as chrome unless the user overrides the browser name in the extension settings. So by + // default their events land in the chrome bucket and their app names have to be matched + // here (#927, ActivityWatch/activitywatch#1094). The standalone arc key below only covers + // setups where Arc was picked explicitly in the settings, which changes the bucket name. + chrome: '(?i)^(google[-_ ]?chrome|chrome|chromium|arc(\\.exe)?$|dia(\\.exe)?$)', firefox: '(?i)(firefox|librewolf|waterfox|nightly)', opera: '(?i)(opera)', brave: '(?i)(brave)', diff --git a/test/unit/queries.test.node.ts b/test/unit/queries.test.node.ts index b3eae0c7..9b15c23e 100644 --- a/test/unit/queries.test.node.ts +++ b/test/unit/queries.test.node.ts @@ -36,6 +36,8 @@ * (Flatpak app IDs retained: 'com.microsoft.Edge', 'com.microsoft.EdgeDev') * * Arc: 'arc.exe', 'Arc.exe', 'Arc' + * (also matched by the chrome pattern, since Arc reports to the chrome bucket + * unless the browser name is overridden in the extension settings) * * Vivaldi: 'Vivaldi-stable', 'Vivaldi-snapshot', 'vivaldi.exe', 'Vivaldi.exe', 'Vivaldi' * (Flatpak app ID retained: 'com.vivaldi.Vivaldi') @@ -81,6 +83,12 @@ describe('browser_appname_regex', () => { 'chromium.exe', 'Google-chrome-beta', 'Google-chrome-unstable', + // Chromium forks that report through the chrome extension bucket (#927) + 'Arc', + 'arc.exe', + 'Arc.exe', + 'Dia', + 'Dia.exe', ]; for (const name of knownNames) { expect(re.test(name)).toBe(true); @@ -93,6 +101,10 @@ describe('browser_appname_regex', () => { expect(re.test('com.google.Chrome')).toBe(false); expect(re.test('Slack')).toBe(false); expect(re.test('Electron')).toBe(false); + // The fork alternatives are anchored, so names merely starting with them don't match + expect(re.test('archive')).toBe(false); + expect(re.test('arcade')).toBe(false); + expect(re.test('Dialog')).toBe(false); }); test('firefox pattern matches all known Firefox/LibreWolf/Waterfox app names', () => {