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/gui/GlobalSettingsPage.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/gui') diff --git a/src/gui/GlobalSettingsPage.cpp b/src/gui/GlobalSettingsPage.cpp index 7b7bea5..d3d440d 100644 --- a/src/gui/GlobalSettingsPage.cpp +++ b/src/gui/GlobalSettingsPage.cpp @@ -89,11 +89,14 @@ namespace gsr { } std::unique_ptr GlobalSettingsPage::create_hotkey_subsection(ScrollablePage *parent_page) { - auto list = std::make_unique(List::Orientation::VERTICAL); - auto enable_hotkeys_radio_button = std::make_unique(&get_theme().body_font, RadioButton::Orientation::HORIZONTAL); + const bool inside_flatpak = getenv("FLATPAK_ID") != NULL; + + auto enable_hotkeys_radio_button = std::make_unique(&get_theme().body_font, RadioButton::Orientation::VERTICAL); enable_hotkeys_radio_button_ptr = enable_hotkeys_radio_button.get(); - enable_hotkeys_radio_button->add_item("Enable hotkeys and restart", "enable_hotkeys"); - enable_hotkeys_radio_button->add_item("Disable hotkeys and restart", "disable_hotkeys"); + enable_hotkeys_radio_button->add_item("Enable hotkeys", "enable_hotkeys"); + if(!inside_flatpak) + enable_hotkeys_radio_button->add_item("Disable hotkeys", "disable_hotkeys"); + enable_hotkeys_radio_button->add_item("Only grab virtual devices (supports input remapping software)", "enable_hotkeys_virtual_devices"); enable_hotkeys_radio_button->on_selection_changed = [&](const std::string&, const std::string &id) { if(!on_click_exit_program_button) return true; @@ -102,11 +105,12 @@ namespace gsr { on_click_exit_program_button("restart"); else if(id == "disable_hotkeys") on_click_exit_program_button("restart"); + else if(id == "enable_hotkeys_virtual_devices") + on_click_exit_program_button("restart"); return true; }; - list->add_widget(std::move(enable_hotkeys_radio_button)); - return std::make_unique("Hotkeys", std::move(list), mgl::vec2f(parent_page->get_inner_size().x, 0.0f)); + return std::make_unique("Hotkeys", std::move(enable_hotkeys_radio_button), mgl::vec2f(parent_page->get_inner_size().x, 0.0f)); } std::unique_ptr