From 7b475bad0fe22c3b2fd994cf91866470f8751751 Mon Sep 17 00:00:00 2001 From: Tiberius Dourado Date: Wed, 5 Aug 2026 19:14:16 -0300 Subject: [PATCH] fix(queries): match Arc and Dia in the chrome appname patterns Chromium forks run the chrome build of the extension, which announces itself as chrome unless the browser name is overridden in the extension settings. So by default their events land in the aw-watcher-web-chrome bucket while aw-watcher-window reports their own app names, which the chrome patterns didn't match, leaving the Browser view empty. The standalone arc key stays: it covers buckets created when Arc is picked explicitly in the settings. Fixes #927 --- src/queries.ts | 7 ++++++- test/unit/queries.test.node.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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', () => {