diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-02-22 13:31:51 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-02-22 13:31:51 +0100 |
commit | 189736c1a96a1ad0e571ad69f01039e96455011a (patch) | |
tree | 22e1a78f698209e2ce0ef462a5d281b5b3030897 /src/main.cpp | |
parent | 8003c209fea16cd164817306cb33d46ac61a44f0 (diff) |
Add option to take a screenshot (default hotkey: alt+f1)
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index ffaf596..169721e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include <signal.h> #include <string.h> #include <limits.h> +#include <malloc.h> #include <mglpp/mglpp.hpp> #include <mglpp/system/Clock.hpp> @@ -72,6 +73,11 @@ static void rpc_add_commands(gsr::Rpc *rpc, gsr::Overlay *overlay) { fprintf(stderr, "rpc command executed: %s\n", name.c_str()); overlay->save_replay(); }); + + rpc->add_handler("take-screenshot", [overlay](const std::string &name) { + fprintf(stderr, "rpc command executed: %s\n", name.c_str()); + overlay->take_screenshot(); + }); } static bool is_gsr_ui_virtual_keyboard_running() { @@ -150,6 +156,7 @@ enum class LaunchAction { int main(int argc, char **argv) { setlocale(LC_ALL, "C"); // Sigh... stupid C + mallopt(M_MMAP_THRESHOLD, 65536); if(geteuid() == 0) { fprintf(stderr, "Error: don't run gsr-ui as the root user\n"); |