Tweak alphabetic (default) sort behavior.

Authored by hein on Feb 7 2017, 8:19 AM.



Alphabetical sorting currently compares a concatenation of
"AppName" (determined by heuristic) and Qt::DisplayRole (usually
the window title) using QString::localeAwareSort. This reflects
that the motivation behind alphabetical sorting is generally to
keep windows belonging to the same app grouped together and then
order those groups alphabetically.

The current code achieves this, but the particulars turn out to
negatively impact users of multi-windowed apps that frequently
change window titles in ways that impact sorting, particularly
tabbed web browsers. Switching between tabs may change the order
of browser windows on the Task Manager. Multiple instances of
feedback suggest this is jarring and unexpected, despite
technically being alphabetical.

This patch changes behavior as follows:

  1. Instead of comparing "<App Name><DisplayRole>" it will try to only compare "<App Name>", falling back to "<DisplayRole>" if the app name can't be determined.
  2. If two tasks compare to equal in the above, it will fall back to source model row order, i.e. creation/append sorting.

This still achieves the primary goal laid out above while
keeping the sort order within an app "group" stable when using
alphabetical sorting.

An alternative means to achive this behavior would be via existing
Task Manager settings. To wit:

  1. Enable grouping
  2. Disable group popups, so groups are instead maintained inline on the widget

I'm actually considering suggesting the above (plus changing
sorting to Manual) as new default settings for 5.10 - but in
the meantime it still makes sense to tune the alphabetical
sorting mode in this way, and put the improved behavior into
5.8 and 5.9 to address user feedback earlier.

Diff Detail

R120 Plasma Workspace
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
hein updated this revision to Diff 10988.Feb 7 2017, 8:19 AM
hein retitled this revision from to Tweak alphabetic (default) sort behavior..
hein updated this object.
hein edited the test plan for this revision. (Show Details)
hein added reviewers: Plasma, davidedmundson.
hein added a subscriber: plasma-devel.
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 7 2017, 8:19 AM
davidedmundson accepted this revision.Feb 16 2017, 12:55 PM
davidedmundson edited edge metadata.
davidedmundson added inline comments.

copy your commit message reasoning here

This revision is now accepted and ready to land.Feb 16 2017, 12:55 PM
This revision was automatically updated to reflect the committed changes.