* @brief Switch active group by index. */
| 293 | * @brief Switch active group by index. |
| 294 | */ |
| 295 | API::CommandResponse API::Handlers::WindowHandler::setActiveGroupIndex(const QString& id, |
| 296 | const QJsonObject& params) |
| 297 | { |
| 298 | if (!params.contains(QStringLiteral("index"))) { |
| 299 | return CommandResponse::makeError( |
| 300 | id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: index")); |
| 301 | } |
| 302 | |
| 303 | auto* taskbar = UI::UISessionRegistry::instance().primaryTaskbar(); |
| 304 | if (!taskbar) |
| 305 | return noSession(id); |
| 306 | |
| 307 | const int index = params.value(QStringLiteral("index")).toInt(); |
| 308 | QMetaObject::invokeMethod(taskbar, [taskbar, index]() { taskbar->setActiveGroupIndex(index); }); |
| 309 | |
| 310 | QJsonObject result; |
| 311 | result[QStringLiteral("index")] = index; |
| 312 | return CommandResponse::makeSuccess(id, result); |
| 313 | } |
| 314 | |
| 315 | //-------------------------------------------------------------------------------------------------- |
| 316 | // Window states |
nothing calls this directly
no test coverage detected