Skip to content

feat: show system notification once download is complete, canceled or failed#8235

Open
Clstialdev wants to merge 2 commits intozen-browser:devfrom
Clstialdev:download-notification
Open

feat: show system notification once download is complete, canceled or failed#8235
Clstialdev wants to merge 2 commits intozen-browser:devfrom
Clstialdev:download-notification

Conversation

@Clstialdev
Copy link
Copy Markdown

@Clstialdev Clstialdev commented May 11, 2025

Added desktop notifications for download events.
The browser now shows a system notification when a download:

  • completes successfully

  • is canceled

  • fails due to error

Each notification:

  • Uses a localized title and message (document.l10n.formatValue)

  • Falls back to plain strings if localization fails

  • Includes the downloaded file's path

  • Uses the standard download.svg icon

  • Can be toggled via the zen.downloads.download-notifications preference

This enhancement improves user feedback and aligns with modern UX expectations for background downloads.

image

Translations (l10n): zen-browser/l10n-packs#153

@Clstialdev Clstialdev requested a review from mr-cheffy May 11, 2025 14:52
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Feature labels May 11, 2025
@mr-cheffy
Copy link
Copy Markdown
Member

How does it look?

@Clstialdev
Copy link
Copy Markdown
Author

How does it look?

It uses the system notifications (OS notifications), on Linux it looks like this:
image

I also made this PR to add translation: zen-browser/l10n-packs#153

@mr-cheffy
Copy link
Copy Markdown
Member

Oh, sorry! The images didnt load.

@Clstialdev
Copy link
Copy Markdown
Author

Oh, sorry! The images didnt load.

@mauro-balades I added the images after your comment, do let me know if you want any changes done! 🙏

@Clstialdev
Copy link
Copy Markdown
Author

Hi @mauro-balades, I hope you're doing well! Just wanted to kindly check in on this PR. Let me know if there's anything I can clarify or improve. I’d be happy to make any adjustments if needed. Thanks for your time 🙏

Comment on lines +37 to +45
onDownloadChanged: download => {
if (download.succeeded) {
this.#handleDownloadComplete(download);
} else if (download.canceled) {
this.#handleDownloadCanceled(download);
} else if (download.error) {
this.#handleDownloadFailed(download);
}
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe more cool:

if (download.succeeded) {
  this.#handleDownloadComplete(download);
}

if (download.canceled) {
  this.#handleDownloadCanceled(download);
} 

if (download.error) {
  this.#handleDownloadFailed(download);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I politely disagree. The original is doing pattern matching, download is expected to only be one of the 3 possible values. Your version always checks all cases, even if the correct one was matched already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants