Commit 813749e7 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Task Manager] Let mouse back/forward keys switch tracks

This allows to change tracks by clicking the respective task manager entry with the mouse browser back and forward keys.
Makes it consistent with media controller applet but the target is a lot easier to hit.

Differential Revision: https://phabricator.kde.org/D9797
parent 9b8029fd
......@@ -76,7 +76,7 @@ MouseArea {
toolTipArea.hideToolTip();
}
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton | Qt.BackButton | Qt.ForwardButton
onPidChanged: updateAudioStreams()
onAppNameChanged: updateAudioStreams()
......@@ -130,7 +130,7 @@ MouseArea {
}
onPressed: {
if (mouse.button == Qt.LeftButton || mouse.button == Qt.MidButton) {
if (mouse.button == Qt.LeftButton || mouse.button == Qt.MidButton || mouse.button === Qt.BackButton || mouse.button === Qt.ForwardButton) {
pressed = true;
pressX = mouse.x;
pressY = mouse.y;
......@@ -162,6 +162,17 @@ MouseArea {
if (plasmoid.configuration.showToolTips) {
hideToolTipTemporarily();
}
} else if (mouse.button === Qt.BackButton || mouse.button === Qt.ForwardButton) {
var sourceName = mpris2Source.sourceNameForLauncherUrl(model.LauncherUrlWithoutIcon, model.AppPid);
if (sourceName) {
if (mouse.button === Qt.BackButton) {
mpris2Source.goPrevious(sourceName);
} else {
mpris2Source.goNext(sourceName);
}
} else {
mouse.accepted = false;
}
}
backend.cancelHighlightWindows();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment