Commit ebaddb7d authored by Nate Graham's avatar Nate Graham 🔩
Browse files

[applets/taskmanager] Offer better options when activating grouped tasks

Currently we get many complaints about the behavior of clicking on
grouped tasks, especially for the Icons-Only Task Manager, where the
Present Windows effect is always used when available.

This commit overhauls what happens when you click on a grouped task to
offer three options:
1. Show tooltips (new default setting)
2. Show Present Windows effect
3. Show textual list (AKA group dialog)

The user is now free to choose in the settings window which visualization
best suits them.

This commit does not implement the most heavily-requested option--to
bring forward all of the windows belonging to a grouped task
(https://bugs.kde.org/show_bug.cgi?id=370258)--as it is still blocked by
some technical isues related to stacking order and outstanding UX
uncertainty regarding what should happen when one or more of the windows
in a group happens to beminimized. However, since this commit introduces
a config UI for choosing the desired behavior when activating a grouped
task, there is now a place to put that option once it is implemented.

BUG: 424268
BUG: 390400
CCBUG: 370258
FIXED-IN: 5.20

Depends on frameworks/plasma-framework!39
parent 65106759
......@@ -6,7 +6,7 @@ set(PROJECT_VERSION "5.19.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.12.0")
set(KF5_MIN_VERSION "5.72.0")
set(KF5_MIN_VERSION "5.73.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
......
......@@ -26,6 +26,10 @@
<label>How tasks are grouped: 0 = Do Not Group, 1 = By Program Name</label>
<default>1</default>
</entry>
<entry name="groupedTaskVisualization" type="Enum">
<label>What happens when clicking on a grouped task: 0 = try to show tooltips, 1 = try to show present Windows effect, 2 = show textual list (AKA group dialog)</label>
<default>0</default>
</entry>
<entry name="groupPopups" type="Bool">
<label>Whether groups are to be reduced to a single task button and expand into a popup or task buttons are grouped on the widget itself.</label>
<default>true</default>
......
......@@ -25,11 +25,14 @@ import org.kde.kirigami 2.4 as Kirigami
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet
Item {
width: childrenRect.width
height: childrenRect.height
property alias cfg_groupingStrategy: groupingStrategy.currentIndex
property alias cfg_groupedTaskVisualization: groupedTaskVisualization.currentIndex
property alias cfg_groupPopups: groupPopups.checked
property alias cfg_onlyGroupWhenFull: onlyGroupWhenFull.checked
property alias cfg_sortingStrategy: sortingStrategy.currentIndex
......@@ -41,6 +44,10 @@ Item {
property alias cfg_showOnlyCurrentActivity: showOnlyCurrentActivity.checked
property alias cfg_showOnlyMinimized: showOnlyMinimized.checked
TaskManagerApplet.Backend {
id: backend
}
Kirigami.FormLayout {
anchors.left: parent.left
anchors.right: parent.right
......@@ -53,6 +60,48 @@ Item {
model: [i18n("Do not group"), i18n("By program name")]
}
// TODO: port to QQC2 version once we've fixed https://bugs.kde.org/show_bug.cgi?id=403153
QQC1.ComboBox {
id: groupedTaskVisualization
Kirigami.FormData.label: i18n("Clicking grouped task shows:")
Layout.fillWidth: true
// FIXME: minimum width once this is ported to QQC2
Layout.preferredWidth: Kirigami.Units.gridUnit * 14
enabled: groupingStrategy.currentIndex !== 0
model: [
i18n("Tooltip window thumbnails"),
i18n("'Present Windows' effect"),
i18n("Textual list"),
]
}
// "You asked for Tooltips but Tooltips are disabled" message
Kirigami.InlineMessage {
Layout.fillWidth: true
visible: groupedTaskVisualization.currentIndex === 0 && !plasmoid.configuration.showToolTips && backend.canPresentWindows()
type: Kirigami.MessageType.Warning
text: i18n("Tooltips are disabled, so the 'Present Windows' effect will be displayed instead.")
}
// "You asked for Tooltips but Tooltips are disabled and Present Windows is not available" message
Kirigami.InlineMessage {
Layout.fillWidth: true
visible: groupedTaskVisualization.currentIndex === 0 && !plasmoid.configuration.showToolTips && !backend.canPresentWindows()
type: Kirigami.MessageType.Warning
text: i18n("Tooltips are disabled, and the 'Present Windows' effect is not enabled or otherwise available right now, so a textual list will be displayed instead")
}
// "You asked for Present Windows but Present Windows is not available" message
Kirigami.InlineMessage {
Layout.fillWidth: true
visible: groupedTaskVisualization.currentIndex === 1 && !backend.canPresentWindows()
type: Kirigami.MessageType.Warning
text: i18n("The 'Present Windows' effect is not enabled or otherwise available right now, so a textual list will be displayed instead.")
}
Item {
Kirigami.FormData.isSection: true
}
CheckBox {
id: groupPopups
visible: (plasmoid.pluginName !== "org.kde.plasma.icontasks")
......
......@@ -75,6 +75,9 @@ MouseArea {
|| (task.contextMenu && task.contextMenu.status === PlasmaComponents.DialogStatus.Open)
|| (groupDialog.visible && groupDialog.visualParent === task)
function showToolTip() {
toolTipArea.showToolTip();
}
function hideToolTipTemporarily() {
toolTipArea.hideToolTip();
}
......@@ -129,7 +132,6 @@ MouseArea {
if (model.IsWindow === true) {
tasks.windowsHovered(model.WinIdList, containsMouse);
}
}
onPressed: {
......@@ -164,10 +166,10 @@ MouseArea {
tasksModel.requestVirtualDesktops(modelIndex(), [virtualDesktopInfo.currentDesktop]);
}
} else if (mouse.button == Qt.LeftButton) {
TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task);
if (plasmoid.configuration.showToolTips) {
if (plasmoid.configuration.showToolTips && toolTipArea.active) {
hideToolTipTemporarily();
}
TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task);
} else if (mouse.button === Qt.BackButton || mouse.button === Qt.ForwardButton) {
var sourceName = mpris2Source.sourceNameForLauncherUrl(model.LauncherUrlWithoutIcon, model.AppPid);
if (sourceName) {
......
......@@ -97,14 +97,34 @@ function activateTask(index, model, modifiers, task) {
if (modifiers & Qt.ShiftModifier) {
tasksModel.requestNewInstance(index);
} else if (model.IsGroupParent === true) {
if ((iconsOnly || modifiers == Qt.ControlModifier) && backend.canPresentWindows()) {
task.toolTipAreaItem.hideToolTip();
// If tooltips are enabled and selected as the visualization, show
// tooltips
if (plasmoid.configuration.showToolTips
&& plasmoid.configuration.groupedTaskVisualization === 0
) {
task.showToolTip();
}
// Otherwise, or if present windows effect is selected as the
// visualization, invoke it if it's available
else if (backend.canPresentWindows()
&& (plasmoid.configuration.groupedTaskVisualization === 1
|| plasmoid.configuration.groupedTaskVisualization === 0)
) {
task.hideToolTipTemporarily();
tasks.presentWindows(model.WinIdList);
} else if (groupDialog.visible) {
groupDialog.visible = false;
} else {
groupDialog.visualParent = task;
groupDialog.visible = true;
}
// If that's not available either, or if the group dialog is selected
// as the visualization, show that
else if (plasmoid.configuration.groupedTaskVisualization === 2) {
if (groupDialog.visible) {
task.hideToolTipTemporarily();
groupDialog.visible = false;
} else {
groupDialog.visualParent = task;
groupDialog.visible = true;
}
}
} else {
if (model.IsMinimized === true) {
......
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