Fix: User avatar not updating in menu (#13489)#13494
Open
carsteneu wants to merge 1 commit intolinuxmint:masterfrom
Open
Fix: User avatar not updating in menu (#13489)#13494carsteneu wants to merge 1 commit intolinuxmint:masterfrom
carsteneu wants to merge 1 commit intolinuxmint:masterfrom
Conversation
Fixes two related issues when changing user profile pictures: 1. **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/<user>), so the URL stays identical while only the file content changes. 2. **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/<user>-<mtime> 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.
1882ffa to
1fa8538
Compare
carsteneu
referenced
this pull request
Feb 3, 2026
Having the user's avatar picture set as a background-image is nice because it allows us to round the image or add a border easily via themes, but when the user chooses a new image, it's not so easy to force the image to be updated, even though the StTextureCache notices the change and drops it from its own cache. This is mainly an issue when selecting a custom image from a user directory or a photo - AccountsService copies these to /var/lib/ AccountsService/icons/<user>. So, the file may change but the path does not, which keeps Cinnamon from updating it. Monitor the texture cache and recreate the avatar image entirely when it changes instead - this forces an entirely new actor and theme context for it, and gets the proper updated image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.