fix hyprctl with relative negative

This commit is contained in:
vaxerski 2022-07-19 14:24:03 +02:00
parent 21217bcb2b
commit c6c3d66373

View file

@ -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";