microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.8k stars 320 forks source link

Add methods to UserProfilePersonalizationSettings for retrieving lock screen and desktop background #662

Open JaiganeshKumaran opened 3 years ago

JaiganeshKumaran commented 3 years ago

Proposal: Add methods to UserProfilePersonalizationSettings for retrieving lock screen and desktop backgrounds

Today UserProfilePersonalizationSettings has methods to set the lock screen and desktop background asynchronously. I understand that getting the current wallpaper could violate privacy however some customization apps may need to access the lock screen/desktop background to do their job.

Summary

To methods TryGetLockScreenImageAsync and TryGetWallpaperImageAsync could be added to Windows.System.UserProfile.UserProfilePersonalizationSettings. Since this is privacy sensitive, Windows could show a dialog box asking the user whether the user wants to allow the app to access the lock screen/desktop background once. Instead of a permission or a capability, this can be asked every time the app calls the API.

Rationale

Scope

Capability Priority
This proposal will allow developers to access desktop/lockscreen background while being inside a low IL process Must
This proposal will allow end users to let apps access their desktop/lockscreen background Should
This proposal will allow developers to access desktop/lockscreen background silently Won't

Important Notes

Same dialog should be shown when the API is accessed from unpackaged apps although those kinds of apps can use old Win32 APIs to achieve the same which won't show the consent dialog.

Open Questions

Gavin-Williams commented 3 years ago

There is no violation of privacy in a contract based security model. They simply need to add the alert to the application contract. And no dialog is required. Upon installation, the user agrees to the application's access to personalization data such as background image.

jonwis commented 3 years ago

Our pattern of declared capability (in the app manifest) and runtime use (the Request...) apis lets the user know that an app might ask for a power, and makes it clear when the app is asserting that power. Adding the APIs you suggest is interesting, but it'd be behind a combination of those two. The first time the app wants to use the power, the system asks the user - "is it OK for this app to change your background?" and there should be an "always" option so the user is never prompted again. (Although the app needs to Request... each time, subsequent requests may not actually pop the dialog if the user said "always.")

jonwis commented 3 years ago

@Jaiganeshkumaran , can you briefly describe a hypothetical app that would get the user's lockscreen/background images, and what the app would want to do with those? You mention personalization, can you elaborate?

riverar commented 3 years ago

Theoretical app could provide additional features such as daily rotating imagery from a custom source, imagery that changes with day/night cycle, or even other triggers like ProjectReunion CI build failures.

Theoretical app could appear as such: image

ahmed605 commented 3 years ago

An example of what this feature or capability can be used for: acrylic wallpaper tinting like in MacOS So you would request the wallpaper -> get the dominant color -> cache it -> set it as the acrylic tint color

So in this example it would be nice to have a wallpaper change event too

tbolon commented 3 years ago

See also windows Dynamic Theme store app.

FireCubeStudios commented 3 years ago

We need this now

FireCubeStudios commented 3 years ago

I request this functionality be added with Windows 10 support too

FireCubeStudios commented 3 years ago

@Jaiganeshkumaran , can you briefly describe a hypothetical app that would get the user's lockscreen/background images, and what the app would want to do with those? You mention personalization, can you elaborate?

I would use to get wallpaper colors to achieve similair things to this https://twitter.com/LunaNeither/status/1397603160567468042

JuliaAgostino commented 3 years ago

Why not simply just use Winaero Tweaker to extract the images?

JaiganeshKumaran commented 3 years ago

Why not simply just use Winaero Tweaker to extract the images?

You can't do that programmatically in your UWP app. Also, Winaero Tweaker is a Win32 desktop app that reads from the registry which a UWP app can't do that easily except its own private hive (Local storage, roaming storage etc...)