Add KRunner and Activity Manager screen edge

Allows to toggle Activity Manager and bring up KRunner by hitting the configured screen edge.

BUG: 358627
BUG: 245979

Differential Revision: https://phabricator.kde.org/D1105
This commit is contained in:
Kai Uwe Broulik 2016-04-07 21:07:41 +02:00
parent 4c9c0c5143
commit 320eabc8c2
3 changed files with 34 additions and 0 deletions

View file

@ -187,6 +187,8 @@ void KWinScreenEdgesConfig::monitorInit()
monitorAddItem(i18n("No Action"));
monitorAddItem(i18n("Show Desktop"));
monitorAddItem(i18n("Lock Screen"));
monitorAddItem(i18nc("Open krunner", "Run Command"));
monitorAddItem(i18n("Activity Manager"));
// Add the effects
const QString presentWindowsName = BuiltInEffects::effectData(BuiltInEffect::PresentWindows).displayName;
@ -211,6 +213,8 @@ void KWinScreenEdgesConfig::monitorLoadAction(ElectricBorder edge, const QString
QString lowerName = config.readEntry(configName, "None").toLower();
if (lowerName == "showdesktop") monitorChangeEdge(edge, int(ElectricActionShowDesktop));
else if (lowerName == "lockscreen") monitorChangeEdge(edge, int(ElectricActionLockScreen));
else if (lowerName == "krunner") monitorChangeEdge(edge, int(ElectricActionKRunner));
else if (lowerName == "activitymanager") monitorChangeEdge(edge, int(ElectricActionActivityManager));
}
void KWinScreenEdgesConfig::monitorLoad()
@ -307,6 +311,10 @@ void KWinScreenEdgesConfig::monitorSaveAction(int edge, const QString& configNam
config.writeEntry(configName, "ShowDesktop");
else if (item == 2)
config.writeEntry(configName, "LockScreen");
else if (item == 3)
config.writeEntry(configName, "KRunner");
else if (item == 4)
config.writeEntry(configName, "ActivityManager");
else // Anything else
config.writeEntry(configName, "None");
}

View file

@ -93,6 +93,8 @@ enum ElectricBorderAction {
ElectricActionNone, // No special action, not set, desktop switch or an effect
ElectricActionShowDesktop, // Show desktop or restore
ElectricActionLockScreen, // Lock screen
ElectricActionKRunner, // Open KRunner
ElectricActionActivityManager, // Activity Manager
ELECTRIC_ACTION_COUNT
};

View file

@ -242,6 +242,26 @@ bool Edge::handleAction()
}
return true;
}
case ElectricActionKRunner: { // open krunner
QDBusConnection::sessionBus().asyncCall(
QDBusMessage::createMethodCall(QStringLiteral("org.kde.krunner"),
QStringLiteral("/App"),
QStringLiteral("org.kde.krunner.App"),
QStringLiteral("display")
)
);
return true;
}
case ElectricActionActivityManager: { // open activity manager
QDBusConnection::sessionBus().asyncCall(
QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"),
QStringLiteral("/PlasmaShell"),
QStringLiteral("org.kde.PlasmaShell"),
QStringLiteral("toggleActivityManager")
)
);
return true;
}
default:
return false;
}
@ -552,6 +572,10 @@ static ElectricBorderAction electricBorderAction(const QString& name)
return ElectricActionShowDesktop;
} else if (lowerName == QStringLiteral("lockscreen")) {
return ElectricActionLockScreen;
} else if (lowerName == QLatin1String("krunner")) {
return ElectricActionKRunner;
} else if (lowerName == QLatin1String("activitymanager")) {
return ElectricActionActivityManager;
}
return ElectricActionNone;
}