Add option to take a screenshot (default hotkey: alt+f1)

This commit is contained in:
dec05eba
2025-02-22 13:31:51 +01:00
parent 8003c209fe
commit 189736c1a9
31 changed files with 1102 additions and 328 deletions

View File

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