From ad41b3113594006d60331fa51f9c109d844a1836 Mon Sep 17 00:00:00 2001 From: Mike Rivnak Date: Sat, 30 Mar 2024 21:06:11 -0400 Subject: [PATCH] core: Add user description variable (#248) --- src/renderer/widgets/IWidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer/widgets/IWidget.cpp b/src/renderer/widgets/IWidget.cpp index 5d52b7a..24f9994 100644 --- a/src/renderer/widgets/IWidget.cpp +++ b/src/renderer/widgets/IWidget.cpp @@ -112,11 +112,16 @@ IWidget::SFormatResult IWidget::formatString(std::string in) { auto uidPassword = getpwuid(getuid()); char* username = uidPassword->pw_name; + char* user_gecos = uidPassword->pw_gecos; if (!username) Debug::log(ERR, "Error in formatString, username null. Errno: ", errno); + if (!user_gecos) + Debug::log(WARN, "Error in formatString, user_gecos null. Errno: ", errno); + IWidget::SFormatResult result; + replaceAll(in, "$DESC", std::string{user_gecos ? user_gecos : ""}); replaceAll(in, "$USER", std::string{username ? username : ""}); replaceAll(in, "
", std::string{"\n"});