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
+12 -4
View File
@@ -118,7 +118,7 @@ auto AModule::update() -> void {
if (config_["on-update"].isString()) {
pid_children_.push_back(util::command::forkExec(config_["on-update"].asString()));
}
signal_updated.emit(this);
signal_updated.emit(this);
}
// Get mapping between event name and module action name
// Then call overridden doAction in order to call appropriate module action
@@ -222,10 +222,18 @@ bool AModule::handleUserEvent(GdkEventButton* const& e) {
}
// Second call user scripts
if (!format.empty()) {
if (config_[format].isString())
format = config_[format].asString();
else
// If the configured value for this event is a recognized built-in module
// action (registered in eventActionMap_), it has already been dispatched
// via doAction() above / handled by the module itself. Don't additionally
// run it as a shell command (issue #3284). Any other value is still treated
// as a user shell command.
const auto actionIt = eventActionMap_.find(format);
const bool isModuleAction = actionIt != eventActionMap_.cend() && config_[format].isString() &&
config_[format].asString() == actionIt->second;
if (isModuleAction || !config_[format].isString())
format.clear();
else
format = config_[format].asString();
}
if (!format.empty()) {
const int width = gdk_window_get_width(e->window);