Skip to content

Fix: User avatar not updating in menu (#13489)#13494

Open
carsteneu wants to merge 1 commit intolinuxmint:masterfrom
carsteneu:fix-issue-13489-avatar-update
Open

Fix: User avatar not updating in menu (#13489)#13494
carsteneu wants to merge 1 commit intolinuxmint:masterfrom
carsteneu:fix-issue-13489-avatar-update

Conversation

@carsteneu
Copy link
Contributor

After some research i think this 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/), 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/- 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.

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.
@carsteneu carsteneu force-pushed the fix-issue-13489-avatar-update branch 2 times, most recently from 1882ffa to 1fa8538 Compare February 3, 2026 23:03
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant