Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for making Aylur Widgets Avatar working dynamically when user changes Avatar by GNOME settings #56

Closed
D3vil0p3r opened this issue May 26, 2023 · 2 comments

Comments

@D3vil0p3r
Copy link

Aylur's Widgets Dashboard, currently, for getting the Avatar image of the user, it goes to find it in the following path:

/var/lib/AccountsService/icons/<username>

where <username> is an image file.

In GNOME >=40, the folder above is empty and, for getting the Avatar working correctly, a user can create a symbolic link of the image to that path, for example by:

sudo ln -sf $HOME/.face /var/lib/AccountsService/icons/<username>

or can copy directly the avatar image there.

Currently, the Aylur Widgets does not manage the case where a GNOME user goes to Settings -> Users -> and change the avatar with a GNOME default avatar (for example "bicycle" stored on the default avatar GNOME image path in /usr/share/pixmaps/faces/), so, in this case, Aylur's Widgets still keep the old avatar instead of new one.

In GNOME >=40, the Avatar path is specified in /var/lib/AccountsService/users/<username> inside the Icon variable, for example:

[User]
Session=
XSession=gnome-xorg
Icon=/usr/share/pixmaps/faces/bicycle.jpg
SystemAccount=false

and Icon variable value changes according to the avatar user choice in GNOME settings, so it changes dynamically.

For making also Aylur's Widgets dashboard changing dynamically the user avatar, a good approach could be to change the following codes:

extensions/dateMenuTweaks.js

style: 'background-image: url("/var/lib/AccountsService/icons/'+ GLib.get_user_name() +'"); background-size: cover;',

extensions/quickSettingsTweaks.js

background-image: url("/var/lib/AccountsService/icons/${GLib.get_user_name()}");

shared/dashWidgets.js

background-image: url("/var/lib/AccountsService/icons/${GLib.get_user_name()}");

to call NOT /var/lib/AccountsService/icons/${GLib.get_user_name()} but extracting the Icon variable value from /var/lib/AccountsService/users/${GLib.get_user_name()} and using that string value on background-image: url.

In this manner, Aylur's Widgets dashboard avatar will change dynamically with the avatars selected by the user on GNOME Settings -> Users section.

@D3vil0p3r D3vil0p3r changed the title Suggestion for making Aylur Widgets Avatar working when user changes Avatar by GNOME settings Suggestion for making Aylur Widgets Avatar working dynamically when user changes Avatar by GNOME settings May 26, 2023
Aylur added a commit that referenced this issue May 26, 2023
Now if there is no avatar set, there will be a fallback, and also the icon will be correctly shown if a stock icon is set.
@Aylur
Copy link
Owner

Aylur commented May 26, 2023

Fixed it!

@Aylur Aylur closed this as completed May 26, 2023
@D3vil0p3r
Copy link
Author

Thank you very much!

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

No branches or pull requests

2 participants