dotfiles/awes2/binaries/profile-image

35 lines
848 B
Bash
Executable file

#!/usr/bin/env bash
# Depends: Mugshot
# Written by manilarome
awesome_dir="${HOME}/.config/awesome/"
user_profile_dir="${awesome_dir}/configuration/user-profile/"
accountsservice_user_icons="/var/lib/AccountsService/icons/${USER}"
# Check if user image exists
if [ -f "${user_profile_dir}${USER}.png" ];
then
if [ -f "${accountsservice_user_icons}" ];
then
if ! cmp --silent "${user_profile_dir}${USER}.png" "${accountsservice_user_icons}";
then
cp "${accountsservice_user_icons}" "${user_profile_dir}${USER}.png"
fi
printf "${user_profile_dir}${USER}.png"
else
printf "${user_profile_dir}${USER}.png"
fi
exit;
else
if [ -f "${accountsservice_user_icons}" ];
then
cp "${accountsservice_user_icons}" "${user_profile_dir}${USER}.png"
printf "${user_profile_dir}${USER}.png"
exit;
else
printf "default"
exit;
fi
fi