diff --git a/.gitignore b/.gitignore
index 8536d73a..cae94d71 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,8 @@ lib32-mangohud*.tar.*
subprojects/packagecache/
subprojects/imgui-*/
subprojects/Vulkan-Headers-*/
+
+#GNU Global Metadata
+**/GPATH
+**/GRTAGS
+**/GTAGS
\ No newline at end of file
diff --git a/README.md b/README.md
index e9c76083..f360ba0a 100644
--- a/README.md
+++ b/README.md
@@ -120,7 +120,7 @@ A partial list of parameters are below. See the config file for a complete list.
| `offset_x` `offset_y` | Hud position offsets |
| `no_display` | Hide the hud by default |
| `toggle_hud=`
`toggle_logging=` | Modifiable toggle hotkeys. Default are F12 and F2, respectively. |
-| `reload_cfg=` | Change keybind for reloading the config |
+| `reload_cfg=` | Change keybind for reloading the config. Default = `Shift_L F4` |
| `time`
`time_format=%T` | Displays local time. See [std::put_time](https://en.cppreference.com/w/cpp/io/manip/put_time) for formatting help. |
| `gpu_color`
`gpu_color`
`vram_color`
`ram_color`
`io_color`
`engine_color`
`frametime_color`
`background_color`
`text_color` | Change default colors: `gpu_color=RRGGBB`|
| `alpha` | Set the opacity of all text and frametime graph `0.0-1.0` |
diff --git a/bin/MangoHud.conf b/bin/MangoHud.conf
index 62c2998a..22a1b056 100644
--- a/bin/MangoHud.conf
+++ b/bin/MangoHud.conf
@@ -101,9 +101,9 @@ background_alpha=0.5
################## INTERACTION #################
### Change toggle keybinds for the hud & logging
-toggle_hud=F12
-toggle_logging=F2
-reload_cfg=F4
+#toggle_hud=Shift_R F12
+#toggle_logging=F2
+#reload_cfg=Shift_L F4
################## LOG #################
diff --git a/src/keybinds.h b/src/keybinds.h
index c8945f27..328990ea 100644
--- a/src/keybinds.h
+++ b/src/keybinds.h
@@ -10,15 +10,29 @@ double elapsedF2, elapsedF12, elapsedReloadCfg;
uint64_t last_f2_press, last_f12_press, reload_cfg_press;
#ifdef HAVE_X11
-bool key_is_pressed(KeySym ks) {
+bool keys_are_pressed(const std::vector& keys) {
if (!init_x11())
return false;
char keys_return[32];
+ size_t pressed = 0;
+
g_x11->XQueryKeymap(get_xdisplay(), keys_return);
- KeyCode kc2 = g_x11->XKeysymToKeycode(get_xdisplay(), ks);
- bool isPressed = !!(keys_return[kc2 >> 3] & (1 << (kc2 & 7)));
- return isPressed;
+
+ for (KeySym ks : keys) {
+ KeyCode kc2 = g_x11->XKeysymToKeycode(get_xdisplay(), ks);
+
+ bool isPressed = !!(keys_return[kc2 >> 3] & (1 << (kc2 & 7)));
+
+ if (isPressed)
+ pressed++;
+ }
+
+ if (pressed > 0 && pressed == keys.size()) {
+ return true;
+ }
+
+ return false;
}
-#endif
\ No newline at end of file
+#endif
diff --git a/src/overlay.cpp b/src/overlay.cpp
index f5ea34a3..1b910ee5 100644
--- a/src/overlay.cpp
+++ b/src/overlay.cpp
@@ -876,7 +876,7 @@ void check_keybinds(struct overlay_params& params){
if (elapsedF2 >= 500000 && !params.output_file.empty()){
#ifdef HAVE_X11
- pressed = key_is_pressed(params.toggle_logging);
+ pressed = keys_are_pressed(params.toggle_logging);
#else
pressed = false;
#endif
@@ -893,7 +893,7 @@ void check_keybinds(struct overlay_params& params){
if (elapsedF12 >= 500000){
#ifdef HAVE_X11
- pressed = key_is_pressed(params.toggle_hud);
+ pressed = keys_are_pressed(params.toggle_hud);
#else
pressed = false;
#endif
@@ -905,7 +905,7 @@ void check_keybinds(struct overlay_params& params){
if (elapsedReloadCfg >= 500000){
#ifdef HAVE_X11
- pressed = key_is_pressed(params.reload_cfg);
+ pressed = keys_are_pressed(params.reload_cfg);
#else
pressed = false;
#endif
diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp
index d216534c..c0da3b9f 100644
--- a/src/overlay_params.cpp
+++ b/src/overlay_params.cpp
@@ -6,6 +6,8 @@
#include
#include "imgui.h"
#include
+#include
+#include
#include "overlay_params.h"
#include "overlay.h"
@@ -71,28 +73,41 @@ parse_alpha(const char *str)
}
#ifdef HAVE_X11
-static KeySym
+static std::vector
+parse_string_to_keysym_vec(const char *str)
+{
+ std::vector keys;
+ if(g_x11->IsLoaded())
+ {
+ std::stringstream keyStrings(str);
+ std::string ks;
+ while (std::getline(keyStrings, ks, ' ')) {
+ KeySym xk = g_x11->XStringToKeysym(ks.c_str());
+ if (xk)
+ keys.push_back(xk);
+ else
+ std::cerr << "MANGOHUD: Unrecognized key: '" << ks << "'\n";
+ }
+ }
+ return keys;
+}
+
+static std::vector
parse_toggle_hud(const char *str)
{
- if (g_x11->IsLoaded())
- return g_x11->XStringToKeysym(str);
- return 0;
+ return parse_string_to_keysym_vec(str);
}
-static KeySym
+static std::vector
parse_toggle_logging(const char *str)
{
- if (g_x11->IsLoaded())
- return g_x11->XStringToKeysym(str);
- return 0;
+ return parse_string_to_keysym_vec(str);
}
-static KeySym
+static std::vector
parse_reload_cfg(const char *str)
{
- if (g_x11->IsLoaded())
- return g_x11->XStringToKeysym(str);
- return 0;
+ return parse_string_to_keysym_vec(str);
}
#else
#define parse_toggle_hud(x) 0
@@ -348,9 +363,9 @@ parse_overlay_config(struct overlay_params *params,
params->text_color = strtol("ffffff", NULL, 16);
#ifdef HAVE_X11
- params->toggle_hud = XK_F12;
- params->toggle_logging = XK_F2;
- params->reload_cfg = XK_F4;
+ params->toggle_hud = { XK_F12 };
+ params->toggle_logging = { XK_F2 };
+ params->reload_cfg = { XK_Shift_L, XK_F4 };
#endif
// first pass with env var
diff --git a/src/overlay_params.h b/src/overlay_params.h
index 38dbada3..e0c2a55c 100644
--- a/src/overlay_params.h
+++ b/src/overlay_params.h
@@ -2,6 +2,7 @@
#define OVERLAY_PARAMS_H
#include
+#include
#include
#ifdef __cplusplus
@@ -122,9 +123,9 @@ struct overlay_params {
unsigned tableCols;
float font_size;
float background_alpha, alpha;
- KeySym toggle_hud;
- KeySym toggle_logging;
- KeySym reload_cfg;
+ std::vector toggle_hud;
+ std::vector toggle_logging;
+ std::vector reload_cfg;
std::string time_format, output_file, font_file;
std::string pci_dev;