Fix: User avatar not updating in menu (#13489) #13494
Open
+115
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After some research i think this fixes two related issues when changing user profile pictures:
Image caching problem: When selecting a custom image from files, the menu avatar wouldn't update without restarting Cinnamon. This was caused by St's CSS background-image caching - AccountsService copies all custom images to the same path (/var/lib/AccountsService/icons/), so the URL stays identical while only the file content changes.
Size limit: AccountsService rejects images larger than ~1MB with a silent error, preventing large photos from being set as avatars.
Solution:
userWidget.js: Implements cache-busting by copying AccountsService icons to ~/.cache/cinnamon/avatars/- with unique timestamps, forcing St to reload the image. Also resizes oversized images as fallback.
cs_user.py: Resizes large images (>512px) before passing to AccountsService, preventing rejection. Also fixes existing bug where original path was used instead of the resized .face file.
Tested with images up to 9600x6000 (5.4MB) - now displays correctly without Cinnamon restart. I hope this will help.
Looking for Feedback.