Skip to content

[#515] Add top websites and window titles#522

Open
grigor-dochev wants to merge 7 commits into
devfrom
feature/515-top-window-title
Open

[#515] Add top websites and window titles#522
grigor-dochev wants to merge 7 commits into
devfrom
feature/515-top-window-title

Conversation

@grigor-dochev
Copy link
Copy Markdown
Collaborator

Add Top Websites and Window Titles to Retrospection (Closes #515)

Description

Adds two new Retrospection detail cards that summarize where participants spent the most time during the selected day: top websites and top window titles. The cards use compact horizontal bars, durations, and relative percentages to make the details easy to scan alongside the existing Retrospection timeline and insights.

Changes Made

  • New Top websites card showing the top 3 website domains for the selected day
  • New Top window titles card showing the top 3 non-browsing window titles for the selected day
  • Website entries are derived from WorkRelatedBrowsing activity and grouped by domain, without showing the browser app name
  • Window title entries exclude browsing categories to avoid duplicating website activity
  • Other, Unknown, and Idle entries are filtered out before selecting the top 3
  • Relative percentage shown next to each duration, calculated within each card
  • Card accent colors reuse the existing Retrospection activity color mapping used by the timeline legend
  • Added IPC handlers and typed renderer commands for loading top websites and top window titles
  • Updated Retrospection session aggregation to support derived grouping keys such as website domains and cleaned window titles
  • Removed noisy service warnings for intentionally skipped rows during derived aggregation

Implementation Details

  1. Retrospection session reconstruction now supports grouping by a derived key, not only direct fields such as processName or activity. This allows website domains to be extracted from URLs and window titles to be cleaned before aggregation.
  2. getTopWebsiteSessions only considers WorkRelatedBrowsing entries, extracts the hostname from each URL, groups active time by domain, filters irrelevant values, sorts by total duration, and returns the top 3.
  3. getTopWindowTitleSessions excludes browsing categories (WorkRelatedBrowsing, WorkUnrelatedBrowsing, and SocialMedia), strips matching app suffixes from window titles, groups active time by cleaned title, filters irrelevant values, sorts by total duration, and returns the top 3.
  4. Each returned top item carries its source activity so the frontend can use the same category color mapping as the timeline.
  5. Rows with no derived key are treated as expected separators during aggregation instead of creating log warnings.

Screenshots

Light mode Dark mode
Retrospection top websites and window titles in light mode Retrospection top websites and window titles in dark mode

Closes #515

Copy link
Copy Markdown
Member

@casaout casaout left a comment

Choose a reason for hiding this comment

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

great start, thank you!

I now mostly reviewed UI; and will review the code once we've settled on the design

Comment thread src/electron/src/views/RetrospectionView.vue Outdated
Comment thread src/electron/src/views/RetrospectionView.vue Outdated
renderCompactTime(website.totalDurationMs)
}}</span>
<span class="top-item-percentage">{{
getTopItemPercentage(website, topWebsites)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should try to align the design slightly more to the existing design; few suggestions:

  1. the numbering can be simplified (no rounded border); or maybe even removed as it'll be intuitive which one is the highest one?
  2. the fonts should be the same as for the other insight boxes
  3. in the dark mode, i think the light background of the chart is a bit too strong
  4. i think we don't need to display the percentages (as the timeline chart will imply this anyways), and to have more space for the window title)
  5. it can be made a bit more compact, to reduce the overall height of the insights

Great that you're using the activity colors; that's awesome!!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2026-05-18 at 14 19 55

Copy link
Copy Markdown
Member

@casaout casaout May 18, 2026

Choose a reason for hiding this comment

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

It already looks better, thank you. However, to me still looks a bit like it's in light mode (with the bright colors)...

  • I wonder if it'd work better if the barchart was the actual category color
  • the font was white (in dark mode) and dark (as is in light mode)? (then it'd look much more similar to the activities timeline (which also helps to clarify the colors)
  • And the "white" part could be white in light mode; and a very dark shade (i.e. the background color); so the white font would easily be readable

Also, can we vertically make it slightly more compact, such as by removing some of the top/bottom padding between the text and the barchart?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It already looks better, thank you. However, to me still looks a bit like it's in light mode (with the bright colors)...

  • I wonder if it'd work better if the barchart was the actual category color
  • the font was white (in dark mode) and dark (as is in light mode)? (then it'd look much more similar to the activities timeline (which also helps to clarify the colors)
  • And the "white" part could be white in light mode; and a very dark shade (i.e. the background color); so the white font would easily be readable

Also, can we vertically make it slightly more compact, such as by removing some of the top/bottom padding between the text and the barchart?

Screenshot 2026-05-19 at 11 31 37

What do you think of this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that's great, thanks! Do we need the broders at all? and how dos it look in light mode? thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for not being clear earlier, but I think we also don't need the background color; i.e. just the window/website titel (left aligned with the card's title), the bar and the time

image

<span class="top-item-time">{{
renderCompactTime(website.totalDurationMs)
}}</span>
<span class="top-item-percentage">{{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

once we finalize on the design of these "charts", i think we can uniformly use the same design (and CSS) for all 4 boxes: top apps/activities & websites

Comment thread src/electron/electron/main/services/RetrospectionService.ts
Comment thread src/electron/electron/main/services/RetrospectionService.ts Outdated

if (processName) {
const suffixes = [` - ${processName}`, ` — ${processName}`, ` | ${processName}`];
const matchingSuffix = suffixes.find((suffix) => title.endsWith(suffix));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When matching an URL to an activity (not website); e.g. "Overleaf" to "read/write doucment", i think the window/browser cleaning doesn't fully work yet. it's great that it shows the website name first; but on hover one sees for example "4 or more pages"

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is still happening:
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

better, but the and is still in there:

image

Copy link
Copy Markdown
Member

@casaout casaout left a comment

Choose a reason for hiding this comment

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

thanks for the updates! To understand the "algorithm" for loading the actual datasets, extracting window titles, I think it'd be beneficial to add more documentation and rationale. otherwise, it's difficult to review the code, and also later maintain it. Thanks!

Comment thread src/electron/src/views/RetrospectionView.vue Outdated
Comment thread src/electron/electron/main/services/RetrospectionService.ts Outdated
Comment thread src/electron/electron/main/services/RetrospectionService.ts
Comment thread src/electron/electron/main/services/RetrospectionService.ts
Comment thread src/electron/electron/main/services/RetrospectionService.ts
Add in-line comments and doc strings to RetrospectionService
*
* Some browsers expose a title that is effectively the URL, for example
* "github.com/HASEL-UZH/PersonalAnalytics/pull/123". For display we keep the domain plus the last
* two path parts, producing "github.com/pull/123". This avoids unreadable full paths while still
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i like that solution a lot! I was, however just wondering, if it should be github.com/.../pull/123 (i.e. add "..." to indicate it's shortened)

and maybe the same for stripPathFragment?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is also still happening; to clarify, i think here it shoudl show something like C...DevEx in practice: (i.e. add "..." whenever a filepath or website path are shortened)

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is still not solved...

* 6. If the remaining title is still generic, fall back to the captured URL domain.
*
* Examples:
* "4 or more pages - Overleaf - Microsoft Edge" -> "Overleaf"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this might not work in all cases yet (as discussed in our meeting):

Image

Comment thread src/electron/electron/main/services/RetrospectionService.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retrospection: Create Top Website/Window title

2 participants