* hyprctl(repl): go interactive if no Lua was given via args
The previous check would mess up if `-i` was provided, since it'd see
*an argument* and refuse to go interactive, even when it should've (i.e.
`hyprctl -i 0 repl`).
* ipc(socket1): new escape parsing for batch commands
Semicolons are still the command separator, so those have to be escaped
if they appear anywhere inside of commands (e.g. multi-statement Lua
code). Also, literal backslashes need to be escaped as well.
* tests(ipc): add test for hyprctl batch mode
This test case includes slightly weird stuff (semicolons in Lua code;
square brackets) that would break the old parsing logic.
* format: dang braces
* lua: include Lua's error code in eval/repl error responses
* hyprctl: let interactive repl handle multiline input
repl with a simple command (i.e. Lua code provided as a hyprctl arg)
handles multiline input just fine already, but interactive didn't. This
uses the Lua repl's own approach of trying to execute, and letting the
user continue if the exec attempt returns an "unexpected EOF"-type
syntax error. It's a little clunky, but if it's fine for them, it should
be fine for us.
Ref: https://github.com/lua/lua/blob/7579fc9d7ed90240487251dfb69168f8e64e9294/lua.c#L569-L582
* hyprctl: append full multiline command to repl history
* fix format :(
* lua: fix crash on print with no args
Co-authored-by: Dregu <dregu@dreg.us>
---------
Co-authored-by: Dregu <dregu@dreg.us>
* hyprctl: add lua repl and return for eval
* hook print function for repl
* add help
* nix fixes this
* on second thought don't break all tests
* tests
* framebuffer: avoid gluint overflow
GLuint was being initialized to -1 and rolling over to unsigned int max,
its defined behaviour but very unnecessery. add a bool and use it for
checking if allocated or not.
* opengl: avoid gluint rollover
-1 rolls over to unsigned int max, use 0xFF instead.
* core: big uint64_t to int type conversion
there were a few uint64_t to int implicit conversions overflowing int
and causing UB, make all monitor/workspaces/windows use the new
typedefs. also fix the various related 64 to 32 implicit conversions
going around found with -Wshorten-64-to-32
This makes hyprctl start significantly faster.
$ time for ((i=0; i<1000; i++)); do hyprctl/hyprctl -j activewindow >/dev/null; done
Before: 12.269 s (about 12.3 ms/execution)
After: 2.142 s (about 2.1 ms/execution)
Using "awk '/<exp>/{ print $n }'" is more minimal and slightly faster
than using "grep '<exp>' | awk '{ print $n }'".
Signed-off-by: Lincoln Yuji <lincolnyuji@hotmail.com>
* core: move to hyprutils for utils
Nix: add hyprutils dep
* Meson: add hyprutils dep
* flake.lock: update
---------
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>