[plasma/plasma-workspace] shell: shell: Remove Meta+1–9 task-manager shortcut dispatch
Méven Car <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 7e6d689bd31503d059d1ae74abfcc5945b82c212 by Méven Car, on behalf of Salman Farooq.
Committed on 21/07/2026 at 12:48.
Pushed by meven into branch 'master'.
shell: Remove Meta+1–9 task-manager shortcut dispatch
These shortcuts are now registered and dispatched from within the
taskmanager applet's Backend class, alongside the cycling and move
shortcuts introduced in plasma-desktop!3819. The dispatch logic in
ShellCorona::activateTaskManagerEntry(), which used QMetaMethod
introspection to find taskmanager applets, is no longer needed.
This removes the coupling between the shell and the taskmanager
applet's internal QML API. All task-switching shortcuts now live in
one place and use a consistent priority order for multi-panel setups.
Companion MR: plasma-desktop!3884.
M +0 -63 shell/shellcorona.cpp
M +0 -2 shell/shellcorona.h
https://invent.kde.org/plasma/plasma-workspace/-/commit/7e6d689bd31503d059d1ae74abfcc5945b82c212
diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp
index e1d31fb028..9ad41bb7b8 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -223,19 +223,6 @@ void ShellCorona::init()
connect(m_activityController, &KActivities::Controller::activityAdded, this, &ShellCorona::activityAdded);
connect(m_activityController, &KActivities::Controller::activityRemoved, this, &ShellCorona::activityRemoved);
- auto *taskbarActions = new KActionCollection(this);
- for (int i = 0; i < 10; ++i) {
- const int entryNumber = i + 1;
- const auto key = static_cast<Qt::Key>(Qt::Key_0 + (entryNumber % 10));
-
- QAction *action = taskbarActions->addAction(QStringLiteral("activate task manager entry %1").arg(QString::number(entryNumber)));
- action->setText(i18n("Activate Task Manager Entry %1", entryNumber));
- KGlobalAccel::setGlobalShortcut(action, entryNumber < 10 ? QKeySequence(Qt::META | key) : QKeySequence());
- connect(action, &QAction::triggered, this, [this, i] {
- activateTaskManagerEntry(i);
- });
- }
-
new Osd(m_config, this);
// catch when plasmarc changes, so we e.g. enable/disable the OSd
@@ -2990,56 +2977,6 @@ void ShellCorona::activateLauncherMenu(const QString &screenName)
activateLauncherMenu(QString());
}
-void ShellCorona::activateTaskManagerEntry(int index)
-{
- auto activateTaskManagerEntryOnContainment = [](const Plasma::Containment *c, int index) {
- const auto &applets = c->applets();
- for (auto *applet : applets) {
- const auto &provides = applet->pluginMetaData().value(u"X-Plasma-Provides", QStringList());
- if (provides.contains(QLatin1String("org.kde.plasma.multitasking"))) {
- if (QQuickItem *appletInterface = PlasmaQuick::AppletQuickItem::itemForApplet(applet)) {
- if (auto *metaObject = appletInterface->metaObject()) {
- // not using QMetaObject::invokeMethod to avoid warnings when calling
- // this on applets that don't have it or other child items since this
- // is pretty much trial and error.
-
- // Also, "var" arguments are treated as QVariant in QMetaObject
- int methodIndex = metaObject->indexOfMethod("activateTaskAtIndex(QVariant)");
- if (methodIndex == -1) {
- continue;
- }
-
- QMetaMethod method = metaObject->method(methodIndex);
- if (method.invoke(appletInterface, Q_ARG(QVariant, index))) {
- return true;
- }
- }
- }
- }
- }
- return false;
- };
-
- // To avoid overly complex configuration, we'll try to get the 90% usecase to work
- // which is activating a task on the task manager on a panel on the primary screen.
-
- for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) {
- if (it.value()->screen() != m_screenPool->primaryScreen()) {
- continue;
- }
- if (activateTaskManagerEntryOnContainment(it.key(), index)) {
- return;
- }
- }
-
- // we didn't find anything on primary, try all the panels
- for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) {
- if (activateTaskManagerEntryOnContainment(it.key(), index)) {
- return;
- }
- }
-}
-
QString ShellCorona::defaultShell()
{
KSharedConfig::Ptr startupConf = KSharedConfig::openConfig(QStringLiteral("plasmashellrc"));
diff --git a/shell/shellcorona.h b/shell/shellcorona.h
index 6d55af5ae8..115ad041b8 100644
--- a/shell/shellcorona.h
+++ b/shell/shellcorona.h
@@ -281,8 +281,6 @@ private Q_SLOTS:
void handleScreenRemoved(QScreen *screen);
void handleScreenOrderChanged(QList<QScreen *> screens);
- void activateTaskManagerEntry(int index);
-
private:
void sanitizeScreenLayout(const QString &configFileName);
void destroyDesktopsAndPanels();