Skip to content

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.
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