fix: fixed the bottom to top problem
This commit is contained in:
parent
6d01349719
commit
0f21c99d16
2 changed files with 17 additions and 8 deletions
23
src/main.cpp
23
src/main.cpp
|
@ -77,18 +77,32 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
setenv("LC_CTYPE", "", 1);
|
setenv("LC_CTYPE", "", 1);
|
||||||
string namesList;
|
string namesList;
|
||||||
|
vector<string> reversedNamesList;
|
||||||
|
|
||||||
|
bool isFirst = true;
|
||||||
|
|
||||||
|
|
||||||
for (const auto& tableItem : *config) {
|
for (const auto& tableItem : *config) {
|
||||||
try {
|
try {
|
||||||
Action a;
|
Action a;
|
||||||
from_toml(*tableItem.second->as_table(), a);
|
from_toml(*tableItem.second->as_table(), a);
|
||||||
namesList += a.names + "\n";
|
|
||||||
|
reversedNamesList.push_back(a.names);
|
||||||
|
|
||||||
} catch (const invalid_argument& e) {
|
} catch (const invalid_argument& e) {
|
||||||
cerr << invalidvalue.c_str() << e.what() << endl;
|
cerr << invalidvalue.c_str() << e.what() << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reverse(reversedNamesList.begin(), reversedNamesList.end());
|
||||||
|
for (const auto& name : reversedNamesList) {
|
||||||
|
if (!namesList.empty()) {
|
||||||
|
namesList += "\n";
|
||||||
|
}
|
||||||
|
namesList += name;
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
||||||
|
@ -149,12 +163,7 @@ int main(int argc, char* argv[]) {
|
||||||
cout << "What do you want to call your executable?: ";
|
cout << "What do you want to call your executable?: ";
|
||||||
cin >> bexeout;
|
cin >> bexeout;
|
||||||
|
|
||||||
if (bexeout.empty()) {
|
bexe = bexeout.c_str();
|
||||||
cerr << "Error: Executable name cannot be empty." << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* bexe = bexeout.c_str();
|
|
||||||
|
|
||||||
system(("touch /home/$USER/.local/bin/" + string(bexe)).c_str());
|
system(("touch /home/$USER/.local/bin/" + string(bexe)).c_str());
|
||||||
system(("chmod +x /home/$USER/.local/bin/" + string(bexe)).c_str());
|
system(("chmod +x /home/$USER/.local/bin/" + string(bexe)).c_str());
|
||||||
|
|
Loading…
Add table
Reference in a new issue