mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 05:19:48 +01:00
core: Add user description variable (#248)
This commit is contained in:
parent
ad8a1e9b10
commit
ad41b31135
1 changed files with 5 additions and 0 deletions
|
@ -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, "<br/>", std::string{"\n"});
|
||||
|
||||
|
|
Loading…
Reference in a new issue