From c6c3d663736285ea58ce280d289479a2f4c228fe Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 19 Jul 2022 14:24:03 +0200 Subject: fix hyprctl with relative negative --- hyprctl/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hyprctl/main.cpp') diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 8d9b6d96..9bfacaa2 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -202,6 +202,10 @@ std::deque splitArgs(int argc, char** argv) { return result; } +bool isNumber(const std::string& str, bool allowfloat) { + return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); }); +} + int main(int argc, char** argv) { int bflag = 0, sflag = 0, index, c; @@ -215,7 +219,7 @@ int main(int argc, char** argv) { const auto ARGS = splitArgs(argc, argv); for (auto i = 0; i < ARGS.size(); ++i) { - if (ARGS[i][0] == '-') { + if (ARGS[i][0] == '-' && !isNumber(ARGS[i], true) /* For stuff like -2 */) { // parse if (ARGS[i] == "-j" && !fullArgs.contains("j")) { fullArgs += "j"; -- cgit v1.2.3 From 59e34e311e14e62ba2dbcad2870849c87c7f8f24 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 19 Jul 2022 14:27:52 +0200 Subject: fix oopsie include --- hyprctl/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'hyprctl/main.cpp') diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 9bfacaa2..3f85f4a1 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3 From ec2afb563ed804057af38f686c7686c305ffa1d4 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 19 Jul 2022 14:28:37 +0200 Subject: fix oopsie include --- hyprctl/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'hyprctl/main.cpp') diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 3f85f4a1..4ff1aade 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3