aboutsummaryrefslogtreecommitdiffhomepage
path: root/hyprctl
diff options
context:
space:
mode:
authorPhilip Jones <[email protected]>2022-11-10 15:36:36 +0000
committerGitHub <[email protected]>2022-11-10 15:36:36 +0000
commit27cada2a023cd2448c2a870a09895931b036eb4a (patch)
treed23ab2b67107fed1ec78fed98ceafe1a8c89500e /hyprctl
parent153c99217d70288b029e965a8c94152705dbd64a (diff)
downloadHyprland-27cada2a023cd2448c2a870a09895931b036eb4a.tar.gz
Hyprland-27cada2a023cd2448c2a870a09895931b036eb4a.zip
Allow arguments to hyprctl dispatch exec commands. (#990)
Diffstat (limited to 'hyprctl')
-rw-r--r--hyprctl/main.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp
index edae83e1..49327b75 100644
--- a/hyprctl/main.cpp
+++ b/hyprctl/main.cpp
@@ -168,8 +168,11 @@ int dispatchRequest(int argc, char** argv) {
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]);
+ }
request(rq);
return 0;
@@ -253,6 +256,7 @@ bool isNumber(const std::string& str, bool allowfloat) {
int main(int argc, char** argv) {
int bflag = 0, sflag = 0, index, c;
+ bool parseArgs = true;
if (argc < 2) {
printf("%s\n", USAGE.c_str());
@@ -264,7 +268,12 @@ int main(int argc, char** argv) {
const auto ARGS = splitArgs(argc, argv);
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
if (ARGS[i] == "-j" && !fullArgs.contains("j")) {
fullArgs += "j";