Skip to content
Merged
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
7 changes: 6 additions & 1 deletion src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> = {
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)',
Expand Down
12 changes: 12 additions & 0 deletions test/unit/queries.test.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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);
Expand All @@ -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', () => {
Expand Down
Loading