aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/user/userctl
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-16 10:07:26 +0200
committerDanilo M. <danix@danix.xyz>2026-10-16 10:07:26 +0200
commit74de04faa4c51cf2a9442dcfe246dc04d1f8d19a (patch)
tree92f60698e5fef2a2cce528013f55f5767fe416d1 /desktop/modules/user/userctl
parent147247a5aa30cae53c1152c4cc15226338def2f6 (diff)
downloadquickshell-74de04faa4c51cf2a9442dcfe246dc04d1f8d19a.tar.gz
quickshell-74de04faa4c51cf2a9442dcfe246dc04d1f8d19a.zip
fix(user): the avatar is ~/.user-icon.jpg, as hyprlock and SDDM use
The page showed AccountsService's icon, an older picture than the one the rest of the desktop uses: hyprlock, the udt SDDM theme (pointed at it by udt-accent) and the rofi power menu all read ~/.user-icon.jpg. get now prefers that file, and set converts the pick to JPEG there, through a temp file and a rename, before handing it to AccountsService so both agree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/user/userctl')
-rwxr-xr-xdesktop/modules/user/userctl15
1 files changed, 13 insertions, 2 deletions
diff --git a/desktop/modules/user/userctl b/desktop/modules/user/userctl
index d9720d8..5ad31d1 100755
--- a/desktop/modules/user/userctl
+++ b/desktop/modules/user/userctl
@@ -18,7 +18,9 @@
# userctl set <key> <val> write one field to every store holding it
#
# Stores: AccountsService (and through SetRealName the passwd GECOS that
-# LibreOffice reads), KDE's ~/.config/emaildefaults, the global git config.
+# LibreOffice reads), KDE's ~/.config/emaildefaults, the global git config,
+# and ~/.user-icon.jpg, the avatar hyprlock, the SDDM theme and the rofi
+# power menu read (udt-accent points the greeter at it).
# Polkit lets a user change their own AccountsService entry without a prompt.
#
# set prints nothing on success. On a failing write it prints the command and
@@ -30,6 +32,7 @@ set -u
# Character-wise ${x:0:1}, so an accented initial is not cut in half.
export LC_ALL=C.UTF-8
+AVATAR="$HOME/.user-icon.jpg"
ACC=org.freedesktop.Accounts
OBJ="/org/freedesktop/Accounts/User$(id -u)"
IFACE=org.freedesktop.Accounts.User
@@ -77,6 +80,8 @@ case "$1" in
# Read everything first: one error line and exit 1, never blank fields.
for p in RealName:name Email:email IconFile:avatar Language:language Location:location; do
val="$(prop "${p%%:*}")" || { printf 'error=%s\n' "$val"; exit 1; }
+ # The desktop's avatar wins; AccountsService's is the fallback.
+ [[ "${p#*:}" == avatar && -e "$AVATAR" ]] && val="$AVATAR"
out+="${p#*:}=$val"$'\n'
done
printf '%s' "$out"
@@ -104,7 +109,13 @@ case "$1" in
kde EmailAddress "$v"
run git config --global user.email "$v"
;;
- avatar) acc SetIconFile "$v" ;;
+ avatar)
+ # Converted, so the .jpg name is true whatever was picked;
+ # renamed into place, so no reader sees half a file.
+ run magick "$v" -auto-orient -strip "$AVATAR.tmp.jpg"
+ run mv -f "$AVATAR.tmp.jpg" "$AVATAR"
+ acc SetIconFile "$AVATAR"
+ ;;
language) acc SetLanguage "$v" ;;
location) acc SetLocation "$v" ;;
signingkey)