1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-06 18:55:37 +00:00

add cpu temp display and optimize user check

This commit is contained in:
Copper-Eye
2026-01-13 17:21:03 -04:00
parent 68708484e3
commit fae1c88fa2
5 changed files with 48 additions and 37 deletions

View File

@@ -260,11 +260,20 @@ get_user_home() {
}
get_invoking_user() {
if [[ -n "${SUDO_USER:-}" && "${SUDO_USER:-}" != "root" ]]; then
echo "$SUDO_USER"
if [[ -n "${_MOLE_INVOKING_USER_CACHE:-}" ]]; then
echo "$_MOLE_INVOKING_USER_CACHE"
return 0
fi
echo "${USER:-}"
local user
if [[ -n "${SUDO_USER:-}" && "${SUDO_USER:-}" != "root" ]]; then
user="$SUDO_USER"
else
user="${USER:-}"
fi
export _MOLE_INVOKING_USER_CACHE="$user"
echo "$user"
}
get_invoking_uid() {