diff --git a/doc/config_settings.yaml b/doc/config_settings.yaml index 8920fcd4..51d65d06 100644 --- a/doc/config_settings.yaml +++ b/doc/config_settings.yaml @@ -221,11 +221,10 @@ values: - name: lua_mouse_hook desc: |- This function, if defined, will be called by Conky upon receiving mouse - events from X. Requires X support. A table containing event information - will be passed to this function as the first argument. Use this hook for - detecting mouse input and acting on it. Conky puts 'conky_' in front of - function_name to prevent accidental calls to the wrong function unless - you place 'conky_' in front of it yourself. + events from X or Wayland. A table containing event information will be + passed to this function as the first argument. Use this hook for detecting + mouse input and acting on it. Conky requires that the function declaration + has a 'conky_' prefix to prevent accidental calls to the wrong function. args: - function_name - name: lowercase diff --git a/src/display-wayland.cc b/src/display-wayland.cc index f63b6ab4..276e32cc 100644 --- a/src/display-wayland.cc +++ b/src/display-wayland.cc @@ -66,6 +66,7 @@ #ifdef BUILD_MOUSE_EVENTS #include "mouse-events.h" #include +#include #endif #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/src/llua.cc b/src/llua.cc index 8af794b0..f9d346c5 100644 --- a/src/llua.cc +++ b/src/llua.cc @@ -516,7 +516,12 @@ bool llua_mouse_hook(const EventT &ev) { return false; } const std::string raw_hook_name = lua_mouse_hook.get(*state); - std::string hook_name = "conky_" + raw_hook_name; + std::string hook_name; + if (raw_hook_name.rfind("conky_", 0) == 0) { + hook_name = raw_hook_name; + } else { + hook_name = "conky_" + raw_hook_name; + } int ty = lua_getglobal(lua_L, hook_name.c_str()); if (ty == LUA_TNIL) {