From 6c03137610ff70623a22e786a072e89bee4e33e8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 3 Jan 2025 22:35:49 +0100 Subject: Add option to disable hotkeys, add gsr-ui-cli tool to control gsr-ui remotely --- README.md | 2 +- include/Config.hpp | 1 + include/Overlay.hpp | 2 + include/gui/GlobalSettingsPage.hpp | 2 + meson.build | 8 +++ src/Config.cpp | 1 + src/Overlay.cpp | 5 ++ src/gui/GlobalSettingsPage.cpp | 26 +++++++- src/main.cpp | 68 ++++++++++++++++----- tools/gsr-ui-cli/main.c | 118 +++++++++++++++++++++++++++++++++++++ 10 files changed, 217 insertions(+), 16 deletions(-) create mode 100644 tools/gsr-ui-cli/main.c diff --git a/README.md b/README.md index 8755719..6774083 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ There are also additional dependencies needed at runtime: At the moment different keyboard layouts are not supported. The physical layout of keys are used for global hotkeys. If your Z and Y keys are swapped for example then you need to press Alt+Y instead of Alt+Z to open/hide the UI.\ If you experience this issue then please email dec05eba@protonmail.com to get it fixed.\ This program has to grab all keyboards and create a virtual keyboard (`gsr-ui virtual keyboard`) to make global hotkeys work on all Wayland compositors. -This might cause issues for you if you use input remapping software. If this is an issue for you then please email dec05eba@protonmail.com and an option to workaround the issue could be added. +This might cause issues for you if you use input remapping software. To workaround this you can go into settings and disable hotkeys and use the included `gsr-ui-cli` tool to control the UI remotely. You can combine `gsr-ui-cli` commands to hotkeys in your desktop environments hotkey settings. # License This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`. diff --git a/include/Config.hpp b/include/Config.hpp index 87d71dd..dcfdee1 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -43,6 +43,7 @@ namespace gsr { struct MainConfig { int32_t config_file_version = 0; bool software_encoding_warning_shown = false; + bool enable_hotkeys = true; std::string tint_color; }; diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 596d0fc..e802cd0 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -58,6 +58,8 @@ namespace gsr { bool is_open() const; bool should_exit(std::string &reason) const; void exit(); + + const Config& get_config() const; private: void xi_setup(); void handle_xi_events(); diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp index c55648b..06098f0 100644 --- a/include/gui/GlobalSettingsPage.hpp +++ b/include/gui/GlobalSettingsPage.hpp @@ -31,6 +31,7 @@ namespace gsr { private: std::unique_ptr create_appearance_subsection(ScrollablePage *parent_page); std::unique_ptr create_startup_subsection(ScrollablePage *parent_page); + std::unique_ptr create_hotkey_subsection(ScrollablePage *parent_page); std::unique_ptr