From 52ce22ae22670b11c2bc5fac0583e1a4aa4e19f0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 4 Jan 2025 05:39:16 +0100 Subject: Add option to only grab virtual devices, to support input remapping software --- src/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 3cccde2..9c20a81 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,8 +95,8 @@ static std::unique_ptr register_x11_hotkeys(gsr::Overlay return global_hotkeys; } -static std::unique_ptr register_linux_hotkeys(gsr::Overlay *overlay) { - auto global_hotkeys = std::make_unique(); +static std::unique_ptr register_linux_hotkeys(gsr::Overlay *overlay, gsr::GlobalHotkeysLinux::GrabType grab_type) { + auto global_hotkeys = std::make_unique(grab_type); if(!global_hotkeys->start()) fprintf(stderr, "error: failed to start global hotkeys\n"); @@ -314,8 +314,10 @@ int main(int argc, char **argv) { rpc_add_commands(rpc.get(), overlay.get()); std::unique_ptr global_hotkeys = nullptr; - if(overlay->get_config().main_config.enable_hotkeys) - global_hotkeys = register_linux_hotkeys(overlay.get()); + if(overlay->get_config().main_config.hotkeys_enable_option == "enable_hotkeys") + global_hotkeys = register_linux_hotkeys(overlay.get(), gsr::GlobalHotkeysLinux::GrabType::ALL); + else if(overlay->get_config().main_config.hotkeys_enable_option == "enable_hotkeys_virtual_devices") + global_hotkeys = register_linux_hotkeys(overlay.get(), gsr::GlobalHotkeysLinux::GrabType::VIRTUAL); // TODO: Add hotkeys in Overlay when using x11 global hotkeys. The hotkeys in Overlay should duplicate each key that is used for x11 global hotkeys. -- cgit v1.2.3