Merge pull request #3573 from rossmeier/master

add click coordinates to script
This commit is contained in:
Alexis Rouillard
2026-07-04 01:08:26 +02:00
committed by GitHub
+7 -1
View File
@@ -1,5 +1,6 @@
#include "AModule.hpp" #include "AModule.hpp"
#include <fmt/core.h>
#include <fmt/format.h> #include <fmt/format.h>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
@@ -202,7 +203,12 @@ bool AModule::handleUserEvent(GdkEventButton* const& e) {
format.clear(); format.clear();
} }
if (!format.empty()) { if (!format.empty()) {
pid_children_.push_back(util::command::forkExec(format)); const int width = gdk_window_get_width(e->window);
const int height = gdk_window_get_height(e->window);
const std::string cmd =
fmt::format(fmt::runtime(format), fmt::arg("x", (int)round(100. * e->x / width)),
fmt::arg("y", (int)round(100. * e->y / height)));
pid_children_.push_back(util::command::forkExec(cmd));
} }
dp.emit(); dp.emit();
return true; return true;