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

[applets/taskmanager] Make new "cycle through tasks" option the default

This is ultimately the sanest default as it provides the quickest way to
perform the two most common actions for grouped tasks: switching to the
last-used one, or hunting through all of them to find the one you want.
The "Cycle through task" option allows you to perform both actions with
clicks on the same icon, meaning that you don't have to move your cursor
or your visual focus compared to using any of the other three methods.

CCBUG: 370258
parent 39eaa549
......@@ -27,7 +27,7 @@
<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), 3 = cycle through grouped tasks</label>
<label>What happens when clicking on a grouped task: 0 = cycle through grouped tasks, 1 = try to show tooltips, 2 = try to show present Windows effect, 3 = show textual list (AKA group dialog)</label>
<default>0</default>
</entry>
<entry name="groupPopups" type="Bool">
......
......@@ -71,10 +71,10 @@ Item {
enabled: groupingStrategy.currentIndex !== 0
model: [
i18nc("Completes the sentence 'Clicking grouped task cycles through tasks' ", "Cycles through tasks"),
i18nc("Completes the sentence 'Clicking grouped task shows tooltip window thumbnails' ", "Shows tooltip window thumbnails"),
i18nc("Completes the sentence 'Clicking grouped task shows 'Present Windows' effect' ", "Shows 'Present Windows' effect"),
i18nc("Completes the sentence 'Clicking grouped task shows textual list' ", "Shows textual list"),
i18nc("Completes the sentence 'Clicking grouped task cycles through tasks' ", "Cycles through tasks"),
]
}
// "You asked for Tooltips but Tooltips are disabled" message
......
......@@ -101,43 +101,15 @@ function activateTask(index, model, modifiers, task) {
if (modifiers & Qt.ShiftModifier) {
tasksModel.requestNewInstance(index);
} else if (model.IsGroupParent === true) {
// 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);
}
// 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;
}
}
// Cycle through this group's tasks.
// Option 1 (default): Cycle through this group's tasks
// ====================================================
// If the grouped task does not include the currently active task, bring
// forward the most recently used task in the group according to the
// Stacking order.
// Otherwise cycle through all tasks in the group without paying attention
// to the stacking order, which otherwise would change with every click
else if (plasmoid.configuration.groupedTaskVisualization === 3) {
if (plasmoid.configuration.groupedTaskVisualization === 0) {
let childTaskList = [];
let highestStacking = -1;
let lastUsedTask = undefined;
......@@ -176,6 +148,42 @@ function activateTask(index, model, modifiers, task) {
}
}
}
// Option 2: show tooltips for all child tasks
// ===========================================
// Make sure tooltips are actually enabled though; if not, fall through
// to the next option.
if (plasmoid.configuration.showToolTips
&& plasmoid.configuration.groupedTaskVisualization === 1
) {
task.showToolTip();
}
// Option 3: show Present Windows for all child tasks
// ==================================================
// Make sure the Present Windows effect is are actually enabled though;
// if not, fall through to the next option.
else if (backend.canPresentWindows()
&& (plasmoid.configuration.groupedTaskVisualization === 2
|| plasmoid.configuration.groupedTaskVisualization === 1)
) {
task.hideToolTipTemporarily();
tasks.presentWindows(model.WinIdList);
}
// Option 4: show group dialog/textual list
// ========================================
// This is also the final fallback option if Tooltips or Present windows
// are chosen but not actully available
else if (plasmoid.configuration.groupedTaskVisualization === 3) {
if (groupDialog.visible) {
task.hideToolTipTemporarily();
groupDialog.visible = false;
} else {
groupDialog.visualParent = task;
groupDialog.visible = true;
}
}
} else {
if (model.IsMinimized === true) {
tasksModel.requestToggleMinimized(index);
......
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