Skip to content

Commit

Permalink
Merge pull request Alexays#3278 from LukashonakV/ISSUE#3276_cava
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays authored May 18, 2024
2 parents 912d0e8 + 5a1454a commit 8ad7c75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/cava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
std::string strPath{config_["cava_config"].asString()};
const std::string fnd{"XDG_CONFIG_HOME"};
const std::string::size_type npos{strPath.find("$" + fnd)};
if (npos != std::string::npos) strPath.replace(npos, fnd.length() + 1, getenv(fnd.c_str()));
if (npos != std::string::npos) {
if (const char* xdg = getenv(fnd.c_str()))
strPath.replace(npos, fnd.length() + 1, xdg);
else
spdlog::warn("Module {0}. Environment variable \"${1}\" not found", name_, fnd);
}
strcpy(cfgPath, strPath.data());
}
// Load cava config
Expand Down

0 comments on commit 8ad7c75

Please sign in to comment.