mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
Allow arguments to hyprctl dispatch exec commands. (#990)
This commit is contained in:
parent
153c99217d
commit
27cada2a02
1 changed files with 11 additions and 2 deletions
|
@ -168,8 +168,11 @@ int dispatchRequest(int argc, char** argv) {
|
||||||
|
|
||||||
std::string rq = "/dispatch";
|
std::string rq = "/dispatch";
|
||||||
|
|
||||||
for(int i = 2; i < argc; i++)
|
for(int i = 2; i < argc; i++) {
|
||||||
|
if (!strcmp(argv[i], "--"))
|
||||||
|
continue;
|
||||||
rq += " " + std::string(argv[i]);
|
rq += " " + std::string(argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
request(rq);
|
request(rq);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -253,6 +256,7 @@ bool isNumber(const std::string& str, bool allowfloat) {
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
int bflag = 0, sflag = 0, index, c;
|
int bflag = 0, sflag = 0, index, c;
|
||||||
|
bool parseArgs = true;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf("%s\n", USAGE.c_str());
|
printf("%s\n", USAGE.c_str());
|
||||||
|
@ -264,7 +268,12 @@ int main(int argc, char** argv) {
|
||||||
const auto ARGS = splitArgs(argc, argv);
|
const auto ARGS = splitArgs(argc, argv);
|
||||||
|
|
||||||
for (auto i = 0; i < ARGS.size(); ++i) {
|
for (auto i = 0; i < ARGS.size(); ++i) {
|
||||||
if (ARGS[i][0] == '-' && !isNumber(ARGS[i], true) /* For stuff like -2 */) {
|
if (ARGS[i] == "--") {
|
||||||
|
// Stop parsing arguments after --
|
||||||
|
parseArgs = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (parseArgs && (ARGS[i][0] == '-') && !isNumber(ARGS[i], true) /* For stuff like -2 */) {
|
||||||
// parse
|
// parse
|
||||||
if (ARGS[i] == "-j" && !fullArgs.contains("j")) {
|
if (ARGS[i] == "-j" && !fullArgs.contains("j")) {
|
||||||
fullArgs += "j";
|
fullArgs += "j";
|
||||||
|
|
Loading…
Reference in a new issue