Skip to content

feat: add Dia browser support with incognito detection#74

Merged
renjfk merged 3 commits into
renjfk:mainfrom
devmarkpro:feat/dia-browser-support
May 18, 2026
Merged

feat: add Dia browser support with incognito detection#74
renjfk merged 3 commits into
renjfk:mainfrom
devmarkpro:feat/dia-browser-support

Conversation

@devmarkpro
Copy link
Copy Markdown
Contributor

@devmarkpro devmarkpro commented May 17, 2026

Summary

  • Add website tracking support for the Dia browser (by The Browser Company)
  • Detect private/incognito mode using the accessibility API's AXIdentifier attribute
  • Add Dia to the Privacy settings browser support list

Important: New Permission Requirement

This PR requires Accessibility access (System Preferences → Privacy & Security → Accessibility).

Dia's AppleScript dictionary (Dia.sdef) does not expose an incognito or mode property on windows (unlike Arc/Chrome). The only way to detect private browsing is through the macOS Accessibility API (System EventsAXIdentifier), which requires the app to be granted Accessibility permission. Without this, incognito detection for Dia will always return false.

Implementation Details

We use the System Events accessibility API to read the AXIdentifier of the front window:

  • Regular windows: bigBrowserWindow_<UUID>
  • Private windows: bigIncognitoBrowserWindow_<UUID>

Evidence

URL Retrieval (Dia AppleScript)

$ osascript -e 'tell application "Dia"
    if (count of windows) > 0 then
        return URL of active tab of window 1
    end if
end tell'
https://www.mozilla.org/en-US/

Incognito Detection (Accessibility API)

Tested with 4 windows open (2 profiles x 2 modes):

$ osascript -e 'tell application "System Events"
    tell process "Dia"
        set allWindows to every window
        repeat with w in allWindows
            set wId to value of attribute "AXIdentifier" of w
            set wTitle to value of attribute "AXTitle" of w
            set isIncognito to wId contains "Incognito"
            log "Title: " & wTitle & " | ID: " & wId & " | Incognito: " & isIncognito
        end repeat
    end tell
end tell'

Title: Work: Mozilla - Internet… | ID: bigIncognitoBrowserWindow_A3F8D291-7C4E-4A1B-9E52-D6B1F30C84A7 | Incognito: true
Title: Work: Home - Google Driv… | ID: bigBrowserWindow_92E4B716-5D3A-48CF-B0A1-3F7E62D9C158 | Incognito: false
Title: Personal: BBC Home - Bre… | ID: bigIncognitoBrowserWindow_6D2A9F84-B13E-4720-8C9D-E5A47B28F631 | Incognito: true
Title: Personal: Comparing renj… | ID: bigBrowserWindow_F8C15E3A-2D69-4B8E-A4F6-1C93D7E0B52A | Incognito: false

Confirming no native AppleScript property exists

$ osascript -e 'tell application "Dia"
    if (count of windows) > 0 then
        tell front window
            return incognito
        end tell
    end if
end tell'
execution error: The variable incognito is not defined. (-2753)

Test Plan

  • Verify URL retrieval from Dia active tab
  • Verify incognito detection across multiple profiles (Work, Personal)
  • Verify regular windows are correctly identified as non-private
  • Verify private windows are correctly identified across profiles
  • Confirm Dia appears in Privacy settings browser support list

Add website tracking support for the Dia browser (by The Browser Company).
Detect private/incognito mode using the accessibility API's AXIdentifier
attribute, which contains "bigIncognitoBrowserWindow" for private windows.
Add Dia to the Privacy settings browser support list.
@devmarkpro devmarkpro force-pushed the feat/dia-browser-support branch from d464732 to de24fc5 Compare May 17, 2026 19:51
@renjfk
Copy link
Copy Markdown
Owner

renjfk commented May 18, 2026

/prerelease

@github-actions
Copy link
Copy Markdown

Prerelease v0.10-pr74.de24fc5 is ready.

@renjfk
Copy link
Copy Markdown
Owner

renjfk commented May 18, 2026

Hello, thanks for the contribution! Could you also test the newly implemented feature with signed prerelease?

@devmarkpro
Copy link
Copy Markdown
Contributor Author

devmarkpro commented May 18, 2026

Thanks @renjfk ,

I tested it and found an issue is actually bigger than Dia! it also affects Safari private browsing detection.

The root cause is error code -25211 ("not allowed assistive access") which wasn't being handled. I tested with both the pre-release and stable versions: Safari and Dia Private windows were being tracked in both. The app never prompts for Accessibility permission, and without it, any System Events-based detection silently fails.

I'll soon updated the PR to:

  1. Handle -25211 in Dia, Safari, and Firefox so the existing accessibility banner shows up
  2. Call AXIsProcessTrustedWithOptions(prompt: true) at launch to trigger the macOS permission dialog

After granting Accessibility, both Dia incognito and Safari Private are correctly excluded (tested on release build on local). I'll push the updated changes and we can test with a signed pre-release.

So the flow is:

  1. App launches → prompts for accessibility (no banner yet)
  2. User ignores/denies → first time they browse Safari/Dia/Firefox in private mode → -25211 fires → banner appears

…ction

The pre-release and stable builds lacked Accessibility permission,
causing private browsing detection to silently fail for Safari, Firefox,
and Dia. Error code -25211 ("not allowed assistive access") was not
handled, so isInPrivateBrowsingMode() returned false and private windows
were tracked.

- Add -25211 error handling in DiaBrowser, SafariBrowser, and FirefoxBrowser
- Add AXIsProcessTrustedWithOptions prompt at app launch to request
  Accessibility permission on first run
- Add logger and proper permission reporting to DiaBrowser
@renjfk
Copy link
Copy Markdown
Owner

renjfk commented May 18, 2026

/prerelease

@github-actions
Copy link
Copy Markdown

Prerelease v0.10-pr74.d8411b0 is ready.

@renjfk
Copy link
Copy Markdown
Owner

renjfk commented May 18, 2026

/prerelease

@github-actions
Copy link
Copy Markdown

Prerelease v0.10-pr74.20d69ce is ready.

@devmarkpro
Copy link
Copy Markdown
Contributor Author

@renjfk tested on the new pre-release and it works fine.

Copy link
Copy Markdown
Owner

@renjfk renjfk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for the contribution.

@renjfk renjfk merged commit 5e35dab into renjfk:main May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants