return std::vector<std::shared_ptr<UIElement>>{};
}, { { "name" } } };
+ variables["launch_application"] = EvaluationValueFunction{ [&](std::string name) -> EvaluationValue {
+ executeOnMainThread([&]()
+ {
+ bool ret = utils::generateLaunchRequest(name);
+ if (!ret) throw EvaluationFailure{} << "failed to launch application " << name;
+ });
+ return EvaluationValue{};
+ }, { { "name" } } };
+
auto generateTapFunction = [&](size_t tapCount) {
Optional<EvaluationValue> defValue;
if (tapCount > 1)
#include "dbusLocators.hpp"
#include "batch/Monitor.hpp"
+#include <app.h>
+
#include <efl_util.h>
#include <bundle_internal.h>
return dbus.method<void(bool, int, double)>("DispatchRotaryEvent").call(clockwise, multiplicity, delay);
}
+ bool generateLaunchRequest(std::string appId)
+ {
+ app_control_h appControlHandle;
+
+ DEBUG("Launching application %s", appId.c_str());
+
+ auto status = app_control_create(&appControlHandle);
+ RETURN_DEFAULT_IF(status != APP_CONTROL_ERROR_NONE);
+
+ status = app_control_set_operation(appControlHandle, APP_CONTROL_OPERATION_DEFAULT);
+ RETURN_DEFAULT_IF(status != APP_CONTROL_ERROR_NONE);
+
+ status = app_control_set_app_id(appControlHandle, appId.c_str());
+ RETURN_DEFAULT_IF(status != APP_CONTROL_ERROR_NONE);
+
+ status = app_control_send_launch_request(appControlHandle, NULL, NULL);
+ if (status != APP_CONTROL_ERROR_NONE) {
+ ERROR("launching '%s' failed with error code %d", appId.c_str(), status);
+ return false;
+ }
+
+ return true;
+ }
+
std::array<Optional<std::string>, (size_t)Argument::_count> parseArguments(int argc, char **argv)
{
auto b = std::unique_ptr<bundle, int(*)(bundle *)>(bundle_import_from_argv(argc, argv), bundle_free);
DBus::ValueOrError<void> generateDragGesture(int from_x, int from_y, int to_x, int to_y, int steps, double hold_time, int pointers_no = 1);
DBus::ValueOrError<void> generatePinchGesture(int x, int y, int radius_change, int steps);
DBus::ValueOrError<void> generateWheelTurn(bool clockwise, int multiplicity, double delay);
+ bool generateLaunchRequest(std::string appId);
/**
* @brief Enum representing allowed arguments