microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.15k stars 1.44k forks source link

Windows 10 toast notifications from Winget #551

Open Karl-WE opened 4 years ago

Karl-WE commented 4 years ago

Description of the new feature/enhancement

it would be pretty cool to have winget integrated with Windows notifcations / toasts

Proposed technical implementation details (optional)

this script shows how easy it seems to create a notification with a customizable input https://gist.github.com/dend/5ae8a70678e3a35d02ecd39c12f99110

notification for user when install / update was successful or failed

Note: This might raise expectations that winget is able to execute install without local user admin rights because in terms of automation it would make no sense to have notifications for things running via scripts (startup / shutdown at system level)

denelon commented 3 years ago

@Karl-WE I like this as an enhancement. I'll also make sure we add settings so a user may enable or disable notifications.

Trollwut commented 2 years ago

is there any update on this topic?

shawngmc commented 1 year ago

I was just thinking about this a day or two ago when I realized I hadn't updated anything installed this way in months.

I think such a feature could be implemented across a couple MVPs:

  1. Simple toggle for notification that any updates are available.
  2. Include update count.
  3. Add click to run updates. (Knowing that it will require admin.)

Unfortunately, without this, winget-installed apps tend to get out of date easily:

denelon commented 1 year ago

Today, there isn't a service running in the background to invoke winget upgrade to give users notifications for packages that could be updated. In the future, this is something that may change, and I am aware there are some open-source solutions that look for updates and run them in the background. I think adding a "setting" for WinGet to enable a toast when upgrades are detected, as well as when an install has completed, or an upgrade has completed.

We would also likely want both a setting and CLI arguments for "to toast" or "not to toast".

I might want to manually run winget upgrade --all --no-toast so I don't see all the notifications, or I might have the "no-toast" setting configurred, but I do want to get notified when it's completed so I could run it in a terminal tab and minimize it while I do my other work so I could be informed that it's completed. Maybe I don't want a toast per package, but I do want one for the overarching upgrade all flow...

Karl-WE commented 1 year ago

Forgive me this sidenote.

"to toast" or "not to toast", that is the question.

For once let's toast towards the new year and a wonderful future of Winget 🥳

On topic: is there anything else I could provide to this PR?

I agree one toast per package at upgrade all might be less useful as they would flood the notification area. Some might like this verbose information and know something happened others might feel bothered.

Are version upgrades indicating the previous version and new version stored in winget log? Is this log easily accessible via a winget command without using Explorer.

Then I would prefer to have one toast and refer to the logfile on upgrade of several packages and only toast on fresh installation or uninstallation when one package is handled, even when they are more than one but scripted or via Intune.

shawngmc commented 1 year ago

Today, there isn't a service running in the background to invoke winget upgrade to give users notifications for packages that could be updated. In the future, this is something that may change, and I am aware there are some open-source solutions that look for updates and run them in the background. I think adding a "setting" for WinGet to enable a toast when upgrades are detected, as well as when an install has completed, or an upgrade has completed.

So, as a hypothetical MVP, could we start with a CLI option that checks and pops a dialog box or a Windows notification saying there are app updates available? This could then be called via Windows Scheduled Tasks (cron equivalent). It does not need to be a discrete Windows service.

Karl-WE commented 1 year ago

Well I would prefer the idea of a service so we could install things in SYSTEM context. Scheduled task could be altered by a user or 3rd party "optimizers". Of course scheduled task is a simple way to implement this and would remove dependencies to the Windows Core team.

shawngmc commented 1 year ago

Well I would prefer the idea of a service so we could install things in SYSTEM context. Scheduled task could be altered by a user or 3rd party "optimizers". Of course scheduled task is a simple way to implement this and would remove dependencies to the Windows Core team.

I don't disagree here - Scheduled Tasks are alterable by a user. It gets into a philosophical discussion of how this compares to how this is done in other OSes:

I guess the question also becomes what is in charge of the notifications:

This actually leads to a bigger problem - is WinGet currently monolithic? It is one CLI tool, and as far as I know there is no API for another tool to interact with WinGet outside of CLI calls. For example, apt on debian distros has the libapt-pkg library, and it's in charge of maintaining the cache. Yum-compatible tools also have a standardized cache and use a lock to interface with it, but yum/dnf is not the only tooling, AFAIK.

As far as I can tell from a quick search, I don't see any ticket to add an API in the roadmap. #1753 deals with adding structured data output, which could be used by something calling the CLI to generate a toast or other GUI element, but I still get the feeling that this is not the best path forward unless WinGet is intended to stay monolithic.

@denelon, would you be able to provide some insight here? What are WinGet's planned dependencies - .NET, PowerShell, Windows Desktop, Windows Services, Windows Store (which could add some interface in theory)? Is there any possibility of separating the UI (WinGet CLI, a theoretical Windows Package Manager GUI) from the package management 'backend' code? Is there something here that already exists that could be tapped into?

denelon commented 1 year ago

We have already been working on a separate COM API via NuGet packages for system context. The CLI has a COM API available for other applications. The CLI has been gradually being refactored to call the COM API, and the PowerShell module also uses the COM API. The Microsoft Store calls the client COM API, and Intune calls the "in process" COM API available via NuGet which depends on WinGet (via App Installer) being installed.