shift-shell/containments/taskpanel/taskpanel.cpp
Marco Allegretti 5dfae0c45c Add task strip and Overview to navigation panel
In convergence mode, show a running-app icon strip in the navigation
panel using the existing TaskManager.TasksModel. Each icon activates
its window on click, with an indicator dot for the active window.

Replace the mobile task switcher button with a KWin Overview trigger:
add triggerOverview() to TaskPanel (D-Bus call to kglobalaccel), swap
the button icon to view-grid-symbolic, and enable the Overview effect
in the envmanager KWin config when convergence mode is active.

Wire convergenceMode and taskModel properties from
NavigationPanelComponent through to NavigationPanel so the task strip
populates from the existing TasksModel instance.
2026-04-08 19:07:37 +02:00

41 lines
1.3 KiB
C++

/*
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "taskpanel.h"
#include <QDBusConnection>
#include <QDBusPendingReply>
#include <QDebug>
#include <QGuiApplication>
K_PLUGIN_CLASS_WITH_JSON(TaskPanel, "metadata.json")
// register type for Keyboards.KWinVirtualKeyboard.forceActivate();
Q_DECLARE_METATYPE(QDBusPendingReply<>)
TaskPanel::TaskPanel(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: Plasma::Containment(parent, data, args)
{
}
void TaskPanel::triggerTaskSwitcher() const
{
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kglobalaccel", "/component/kwin", "org.kde.kglobalaccel.Component", "invokeShortcut");
message.setArguments({QStringLiteral("Mobile Task Switcher")});
// this does not block, so it won't necessarily be called before the method returns
QDBusConnection::sessionBus().send(message);
}
void TaskPanel::triggerOverview() const
{
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kglobalaccel", "/component/kwin", "org.kde.kglobalaccel.Component", "invokeShortcut");
message.setArguments({QStringLiteral("Overview")});
QDBusConnection::sessionBus().send(message);
}
#include "taskpanel.moc"