aboutsummaryrefslogtreecommitdiffhomepage
path: root/hyprctl
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-07-19 14:24:03 +0200
committervaxerski <[email protected]>2022-07-19 14:24:03 +0200
commitc6c3d663736285ea58ce280d289479a2f4c228fe (patch)
tree7265b8b591f1f72e62944315d7f12fe86f1e5536 /hyprctl
parent21217bcb2bb691ea015563a7ba7ce2d334de6b39 (diff)
downloadHyprland-c6c3d663736285ea58ce280d289479a2f4c228fe.tar.gz
Hyprland-c6c3d663736285ea58ce280d289479a2f4c228fe.zip
fix hyprctl with relative negative
Diffstat (limited to 'hyprctl')
-rw-r--r--hyprctl/main.cpp6
1 files changed, 5 insertions, 1 deletions
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<std::string> 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";