This commit is contained in:
Kaley, Fischer 2024-01-19 20:55:33 +01:00
parent ef2e33eb31
commit 34da973f52

View file

@ -12,6 +12,7 @@
using namespace std; using namespace std;
using namespace cpptoml; using namespace cpptoml;
const string USAGE = R"#(usage: RapidMenu [flags] [<command> [args]] const string USAGE = R"#(usage: RapidMenu [flags] [<command> [args]]
LISTING COMMANDS: LISTING COMMANDS:
-c: To specify which config to use. -c: To specify which config to use.
@ -71,12 +72,10 @@ int main(int argc, char* argv[]) {
try { try {
auto config = parse_file(configFile); auto config = parse_file(configFile);
setenv("LC_CTYPE", "", 1); setenv("LC_CTYPE", "en_US.UTF-8", 1);
string namesList; string namesList;
vector<string> reversedNamesList; vector<string> reversedNamesList;
bool isFirst = true;
for (const auto& tableItem : *config) { for (const auto& tableItem : *config) {
try { try {
Action a; Action a;
@ -91,13 +90,17 @@ int main(int argc, char* argv[]) {
} }
reverse(reversedNamesList.begin(), reversedNamesList.end()); reverse(reversedNamesList.begin(), reversedNamesList.end());
ostringstream namesStream;
for (const auto& name : reversedNamesList) { for (const auto& name : reversedNamesList) {
if (!namesList.empty()) { if (!namesStream.str().empty()) {
namesList += "\n"; namesStream << "\n";
} }
namesList += name; namesStream << name;
} }
namesList = namesStream.str();
string rname = config->get_table("runner")->get_as<string>("rname").value_or("dashboard:"); string rname = config->get_table("runner")->get_as<string>("rname").value_or("dashboard:");
string rtheme = config->get_table("runner")->get_as<string>("rtheme").value_or(""); string rtheme = config->get_table("runner")->get_as<string>("rtheme").value_or("");
string rcommand = config->get_table("runner")->get_as<string>("rcommand").value_or("rofi -dmenu -p"); string rcommand = config->get_table("runner")->get_as<string>("rcommand").value_or("rofi -dmenu -p");