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
2 changes: 2 additions & 0 deletions src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ const browser_appnames: Record<string, string[]> = {
zen: ['app.zen_browser.zen'],
floorp: ['one.ablaze.floorp'],
helium: ['net.imput.helium'],
safari: ['com.apple.Safari'],
};

// Returns a list of (browserName, bucketId) pairs for found browser buckets
Expand Down Expand Up @@ -275,6 +276,7 @@ export const browser_appname_regex: Record<string, string> = {
zen: '(?i)(zen)',
floorp: '(?i)(floorp)',
helium: '(?i)(helium)',
safari: '(?i)^safari(浏览器)?$',
};

// Returns a list of active browser events (where the browser was the active window) from all browser buckets
Expand Down
9 changes: 9 additions & 0 deletions test/unit/queries.test.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,13 @@ describe('browser_appname_regex', () => {
expect(re.test(name)).toBe(true);
}
});

test('safari pattern matches known Safari app names', () => {
const re = toRegex(browser_appname_regex.safari);
expect(re.test('Safari')).toBe(true);
expect(re.test('safari')).toBe(true);
expect(re.test('Safari浏览器')).toBe(true); // macOS Chinese localization
// Should not match unrelated apps
expect(re.test('SafariBrowser')).toBe(false);
});
});
Loading