From 189736c1a96a1ad0e571ad69f01039e96455011a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 22 Feb 2025 13:31:51 +0100 Subject: Add option to take a screenshot (default hotkey: alt+f1) --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main.cpp') 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 #include #include +#include #include #include @@ -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"); -- cgit v1.2.3-70-g09d2