fix(wlr/taskbar): dispatch built-in click actions via doAction, not the shell

wlr/taskbar reads on-click* config values (close, minimize, maximize,
fullscreen, minimize-raise, activate) directly as internal actions in
Task::handle_clicked, but never adopted the eventActionMap_/doAction
mechanism. As a result AModule::handleUserEvent additionally forkExec-ed
the same value as a shell command, e.g. on-click-middle: "close" ran the
action and then failed with "sh: line 1: close: command not found".

Register the taskbar built-in action names in eventActionMap_ so they are
recognized as module actions, and skip the shell forkExec in
handleUserEvent when the configured value is a recognized module action.
Non-action values are still run as user shell commands.

Fixes #3284.
This commit is contained in:
Alex
2026-07-04 12:50:30 +02:00
parent fae2b311de
commit b7a6fa8c91
3 changed files with 34 additions and 5 deletions
+7 -1
View File
@@ -98,6 +98,13 @@ class AModule : public IModule {
bool disable_on_sleep_{false};
GObject* menu_ = nullptr;
// Maps a configured event name (e.g. "on-click-middle") to a built-in module
// action name. Populated from the `actions` config section, and by modules
// that interpret on-click* config values as internal actions (e.g.
// wlr/taskbar). Entries here are dispatched through doAction() instead of
// being run as shell commands.
std::map<std::string, std::string> eventActionMap_;
private:
bool handleUserEvent(GdkEventButton* const& ev);
const bool isTooltip;
@@ -106,7 +113,6 @@ class AModule : public IModule {
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
sigc::connection cursor_timeout_conn_;
std::map<std::string, std::string> eventActionMap_;
static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{
{std::make_pair(1, GdkEventType::GDK_BUTTON_PRESS), "on-click"},
{std::make_pair(1, GdkEventType::GDK_BUTTON_RELEASE), "on-click-release"},