<table><tr><td style="">hein created this revision.<br />Restricted Application added a project: Plasma.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D5522" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This introduces a TryIgnoreRuntimes key in taskmanagerrulesrc's Settings<br />
group that can be used to list known runtime executables that can be<br />
ignored when trying to identify the application owning a window by the<br />
command line of the associated process.</p>

<p>A concrete example is the Frozen Bubble application. Frozen Bubble<br />
installs a frozen-bubble.desktop with Exec=frozen-bubble, yet its<br />
WM_CLASS is ("perl", "perl") and its command line is as follows:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">/usr/bin/perl /usr/bin/frozen-bubble</pre></div>

<p>The existing servicesFromPid() (now split into servicesFromPid() and<br />
servicesFromCmdLine()) does not find the frozen-bubble service because<br />
it works with the leading executable in the command line.</p>

<p>In this patch, TryIgnoreRuntimes is introduced with a default of<br />
"perl". In the new code, after the initial command line matching pass<br />
fails, TryIgnoreRuntimes is checked for whether the leading command<br />
line executable is on the list, and if so, a second command line<br />
matching pass is run with the remainder of the process' command line,<br />
now succeeding.</p>

<p>Note that the approach of "try one more thing" rather than checking<br />
against TryIgnoreRuntimes first is deliberate: The Exec= key in many<br />
.desktop files contains a complete command line prefixed with the<br />
runtime executable. In those cases we don't want to ignore the runtime<br />
executable, or matching would fail.</p>

<p>To complement this, the "perl" WM_CLASS is added to the<br />
MatchCommandLineFirst rc key. Due to the shoddy metadata Frozen<br />
Bubble already ended up in servicesFromPid() regardless, but this<br />
saves some busywork for this WM_CLASS, which can reliably be presumed<br />
bad.</p>

<p>The patch also fixes a small logic error in the match-command-line-<br />
without-arguments block, where the result of a KServiceTypeTrader<br />
query was ignored and immediately overridden by another.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5522" rel="noreferrer">https://phabricator.kde.org/D5522</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>libtaskmanager/taskmanagerrulesrc<br />
libtaskmanager/xwindowtasksmodel.cpp</div></div></div><br /><div><strong>To: </strong>hein, Plasma, davidedmundson, broulik<br /><strong>Cc: </strong>plasma-devel, spstarr, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol<br /></div>