1. 13 Nov, 2019 1 commit
  2. 26 Jul, 2019 1 commit
    • David Edmundson's avatar
      [taskmanager] Simplifiy one of the two PID lookups · afc59d51
      David Edmundson authored
      KwindowInfo already has the PID, which we use in another case where PID is used.
      More importantly I have a patch coming to KWindowSystem that returns the correct PID
      for processes inside a PID namespace, but I don't alter the NETProperties.
      Reviewers: #plasma, apol, hein
      Reviewed By: #plasma, apol, hein
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D22753
  3. 18 Dec, 2018 1 commit
    • Eike Hein's avatar
      Implement support for virtual desktops on Wayland · 52d760c5
      Eike Hein authored
      Includes, among other things:
      * A refactoring towards supporting more than one desktop per window,
        for an eventual virtual desktops / activities merge
      * A scheme for process-internal window ids on Wayland as DND payload
        so DND in and to the Pager works in the shell
      * Implemented various previously missing behavior in WaylandTasksModel
        such as implicit moves of windows to the current desktop on various
      * Expanded VirtualDesktopInfo API so the Pager can better abstract
        over windowing systems
      * Implicit internal sharing of VirtualDesktopInfo since there are many
        more instances now
      * Various cleanups
      Still missing:
      * Fixing the VirtualDesktops data role in the grouping proxy
      * The protocol doesn't have desktop creation/destruction yet, so some
        of the related logic is still missing
      * Some FIXME TODOs in the code when I was unhappy with the current
        KWayland API
      This code is largely untested and subject to change.
      Depends on D12820 and relates to T4457.
      Reviewers: mart, mvourlakos, davidedmundson
      Reviewed By: davidedmundson
      Subscribers: alexde, anthonyfieroni, zzag, ngraham, abetts, plasma-devel
      Tags: #plasma
      Maniphest Tasks: T4457
      Differential Revision: https://phabricator.kde.org/D13745
  4. 19 Nov, 2018 1 commit
    • Kevin Funk's avatar
      ASAN: Fix leak in XWindowTasksModel · 38a50ce7
      Kevin Funk authored
      Direct leak of 24 byte(s) in 3 object(s) allocated from:
          #0 0x544cc0 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/plasmashell+0x544cc0)
          #1 0x7fe4f0e82df9 in TaskManager::XWindowTasksModel::Private::windowInfo(unsigned long long) /home/kfunk/devel/src/kf5/plasma-workspace/libtaskmanager/xwindowtasksmodel.cpp:419:25
          #2 0x7fe4f0e87e69 in TaskManager::XWindowTasksModel::data(QModelIndex const&, int) const /home/kfunk/devel/src/kf5/plasma-workspace/libtaskmanager/xwindowtasksmodel.cpp:646:38
  5. 12 Sep, 2018 1 commit
    • Eike Hein's avatar
      Handle clients which change window metadata during early startup · b15eaf38
      Eike Hein authored
      Some apps initially show their window with bogus/useless window
      metadata and then update to useful metadata during early startup.
      For example, LibreOffice sets WM_CLASS to soffice/Soffice and
      then updates to libreoffice-writer/libreoffice. This leads to
      a poor user experience on particular the Icons-only Task Manager,
      but also the regular Task Manager depending on settings.
      Depending on its configuration (and Icons-only Task Manager is
      a particular set of configuration options, as far as the model
      is concerned), TasksModel will try to sort a new window task
      adjacent to its launcher task. The appearance of a new window
      task also causes matching (in terms of identification) launcher
      or startup tasks to be filtered out. To the user, this forms a
      lifecycle of the launcher being replaced by the window in-place
      (and a startup state inbetween, optionally but by default).
      Prior to this patch, this sorting decision was only done once,
      when a new window enters the source model stack. This meant the
      LibreOffice window would initially be sorted into the "wrong"
      spot (the bogus metadata doesn't allow us to relate it to its
      launcher) and then, following the metadata change, stick to the
      wrong position.
      Simply changing the code to sort things again on any metadata
      change would not have been good enough: Metadata changes can
      occur at any time, and things should not just move around on
      the user - this sort mode is called "Manual" for a reason. Also,
      the visual result would still be poor: The window would initially
      appear at the wrong position, then move to the right one a bit
      This patch takes the following approach:
      * It adds a new config key to taskmanagerrulesrc for listing
        ids of matching tasks to completely hide, and of course the
        code needed to implement this.
      * It adds LibreOffice' bogus initial metadata to this key, so
        the tasks is initially hidden.
      * The sort code skips over hidden window tasks in the sort
        insert queue instead of moving them. The queue is marked as
        stale then, and cleared on unrelated windowing system changes.
      * It resorts when tasks are unhidden (i.e. once the metadata
        update has occured and the task no longer matches the above
        config key).
      The visual result is that the startup notification on the
      launcher spins a little bit longer than before, even though the
      window has already appeared (although LO lags in filling in its
      contents anyway), and then morphs into the window task
      representation once the client has completed the window metadata
      change. This happens in such a short order as to be more or less
      If startup notifications are turned off it's broadly the same,
      minus the spinning.
      Reviewers: davidedmundson, broulik, ngraham
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D15410
  6. 24 May, 2018 1 commit
  7. 29 Mar, 2018 1 commit
    • David Edmundson's avatar
      Batch window changes events on XCB · ec1931f7
      David Edmundson authored
      In a log from someone talking about high CPU we can see get multiple X
      events for the same window as multiple events, but directly next to each
      other. This causes the TaskManager to process changes multiple times
      instead of just once which is a waste.
      An example is just pressing "enter" in konsole, which will pointlessly
      update the title.
      This causes problems for expensive app lookup and also QML performs text layouts immediately so any text changes cause quite large CPU usage if done more than 60fps; especially a task text resizing
      could result in resizing the entire panel.
      Something not relevant in kwin that also monitors these rolls.
      This class sits between KWindowSystem and XWindowTasksModel
      transparently buffering the changes.
      CCBUG: 378010
      BUG: 365317
      Reviewers: #plasma, hein, broulik
      Reviewed By: #plasma, hein, broulik
      Subscribers: ngraham, cfeck, broulik, hein, graesslin, plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde...
  8. 10 Mar, 2018 1 commit
  9. 06 Mar, 2018 1 commit
  10. 13 Feb, 2018 1 commit
  11. 04 Feb, 2018 1 commit
  12. 29 Aug, 2017 1 commit
    • Eike Hein's avatar
      Avoid absolute paths to .desktop files in launcher URLs. · a47d1f19
      Eike Hein authored
      In any place we look up a KService, check if it has a menuId,
      and then generate KAStats-style applications: URL with it. Also
      learn how to handle applications: URLs.
      This was requested by Kai in D7203. His patch makes Kate
      dynamically add its sessions as jump list actions to a copy of its
      .desktop file in $HOME. As the library would generate the absolute
      path to a .desktop file e.g. in /usr as launcher URL before, the
      TM applet would ignore the overriding copy in $HOME and the actions
      wouldn't be found.
      This patch won't rewrite existing config, but LauncherTasksModel
      will resolve the absolute path to the applications: URL as it goes
      through TaskTools, and then return that. The window and startup
      tasks models produce those URLs, too, so things match up. Newly-
      added launchers will then store the applications: URL in config
      Moving away from storing absolute paths when we can is also nice
      in case there is a $HOME .desktop file at the time a launcher is
      added which later gets deleted. Using the new storage format, we
      will now fall back to a system file instead.
      Note the conservative approach taken: We only generate an
      applications: URL when the service returns something for menuId().
      We don't use KService::storageId() here, which can fall back to
      KService::entryPath() - in this case we're better off just using
      the absolute path we already have. We still use storageId() when
      generating the applications: URL for KAStats db insertions, as
      that is more liberal (and matches Kicker).
      It makes sense to look at the Kicker backend code to see if should
      store applications: URLs (which it already produces to insert into
      KAStats) as well.
      This will need a subsequent patch to the Task Manager applet to
      handle applications: URLs there in code that consumes launcher URLs
      to parse things out of .desktop files.
      Contains other minor cleanup and fixes, such as porting the
      LauncherTasksModel to use TaskTools::runApp (which now understands
      preferred: URLs as well), a fix for a small logic error there (the
      && before the !isApplication should have been ||, now moot), and
      not needlessly opening and parsing a .desktop file in
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D7561
  13. 07 Aug, 2017 1 commit
    • Eike Hein's avatar
      Keep fallback icon updated · 75b7f5c2
      Eike Hein authored
      Windows we can't find an app icon for using the normal means
      get the icon used by the windowing system in the Task Manager.
      This fallback icon was then not updated when changed on the
      window, only occasionally as a side-effect of cache evictions
      and model data requests.
      This patch notes which windows hit the fallback path, and for
      those windows evicts the cache when the icon changes on the
      window, causing it to be re-retrieved from the windowing system
      as views respond to the dataChanged signal for the decoration
      Evicting the entire cache is a little bit costly, but:
      - This is a fallback codepath.
      - Apps conventionally update title and icon in one go, meaning
        the cache is often already getting evicted anyway.
      - Icons don't change that often.
      Reviewers: #plasma, davidedmundson
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D7092
  14. 23 Jun, 2017 1 commit
  15. 23 May, 2017 1 commit
  16. 13 May, 2017 1 commit
    • Eike Hein's avatar
      Lift app identification heuristic out of XWindowTasksModel and share it with WaylandTasksModel. · a87f619a
      Eike Hein authored
      This factors the app identification heuristic out of XWindowTasksModel
      and turns it into generic code in TaskTools, producing a URL from a set
      of window metadata bits. The key metadata is the 'appId', which is the
      classClass part of WM_CLASS on X11 and PlasmaWindow::appId on Wayland -
      which KWin sets to the former for XWayland clients. The result is much
      improved support for XWayland clients in the Wayland session, with most
      X clients now identified correctly.
      As a side effect, the Wayland model gains access to the X model's much
      superior code for grabbing a suitable icon, with PlasmaWindow::icon now
      serving only as a fallback, similar to KWindowSystem::icon in the X
      Moving the code to TaskTools also means it now sports nice API docs.
      The heuristic has seen some work as well, namely adding two passes that
      try to parse the appId as a path to a desktop file, which we've never
      seen on X11 but is common on Wayland - this heuristic was previously in
      appDataFromAppId, which has been removed here since the shared heuristic
      now satisfies this case.
      Further, an old codepath handling kcmshell in a special way has been
      removed. This is no longer necessary as we have better ways to tell
      libtaskmanager about the KCM KService now, such as the .desktop file
      window hint on X11 and a reliable appId on Wayland.
      This patch also fixes some bugs around app data cache eviction and
      telling model clients about data changes when cache eviction happens.
      The X model didn't use to evict the cache and refresh when the
      taskmanagerrulesrc file was changed at runtime, and the refresh for
      sycoca changes didn't refresh the LauncherUrlWithoutIcon role. It does
      now, and the Wayland model - which has gained taskmanagerrulesrc support
      by way of the shared heuristic - now behaves in the same way.
      The combined changes achieve near behavior parity between the X
      and Wayland models when it comes to identifying apps by window meta
      data, with the only exception being XWayland clients that need to be
      identified by the (incorrectly used by the client developer) instance
      name part of the WM_CLASS window property, which we can't access (this
      case is so rare it's not worth handling at this time).
      Depends on D5747, D5755.
      Reviewers: #plasma, davidedmundson
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D5818
  17. 24 Apr, 2017 1 commit
    • Eike Hein's avatar
      Introduce a concept of runtime executables that can be ignored. · 1c8a4679
      Eike Hein authored
      This introduces a TryIgnoreRuntimes key in taskmanagerrulesrc's Settings
      group that can be used to list known runtime executables that can be
      ignored when trying to identify the application owning a window by the
      command line of the associated process.
      A concrete example is the Frozen Bubble application. Frozen Bubble
      installs a frozen-bubble.desktop with Exec=frozen-bubble, yet its
      WM_CLASS is ("perl", "perl") and its command line is as follows:
        /usr/bin/perl /usr/bin/frozen-bubble
      The existing servicesFromPid() (now split into servicesFromPid() and
      servicesFromCmdLine()) does not find the frozen-bubble service because
      it works with the leading executable in the command line.
      In this patch, TryIgnoreRuntimes is introduced with a default of
      "perl". In the new code, after the initial command line matching pass
      fails, TryIgnoreRuntimes is checked for whether the leading command
      line executable is on the list, and if so, a second command line
      matching pass is run with the remainder of the process' command line,
      now succeeding.
      Note that the approach of "try one more thing" rather than checking
      against TryIgnoreRuntimes first is deliberate: The Exec= key in many
      .desktop files contains a complete command line prefixed with the
      runtime executable. In those cases we don't want to ignore the runtime
      executable, or matching would fail.
      To complement this, the "perl" WM_CLASS is added to the
      MatchCommandLineFirst rc key. Due to the shoddy metadata Frozen
      Bubble already ended up in servicesFromPid() regardless, but this
      saves some busywork for this WM_CLASS, which can reliably be presumed
      The patch also fixes a small logic error in the match-command-line-
      without-arguments block, where the result of a KServiceTypeTrader
      query was ignored and immediately overridden by another.
      Reviewers: #plasma, davidedmundson, broulik
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D5522
  18. 03 Mar, 2017 1 commit
    • Eike Hein's avatar
      Ignore NoDisplay=true .desktop entries when matching by Name. · 8028a500
      Eike Hein authored
      We currently match Krita by Name. It's classClass is "krita",
      but its DesktopEntryName is org.kde.krita.desktop. However,
      Krita also installs numerous additional .desktop entries to
      associate more file types by itself, all of which match by
      name, and the first one in the list isn't the right one. All
      of those extra .desktop files are NoDisplay=true however, so
      we can filter them out, which brings the match list down to
      the one and only .desktop file we care for.
      Reviewers: #plasma, broulik, davidedmundson
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D4928
  19. 21 Feb, 2017 1 commit
    • Eike Hein's avatar
      Overhaul app associativity heuristic to give precendence to StartupWMClass. · f17a395a
      Eike Hein authored
      WM_CLASS instance and general classes are checked against StartupWMClass
      prior to most rewrite and mapping rules, and prior to the DesktopEntryName
      and Name checks.
      This matches the fd.o spec more closely and makes Chrome Apps and
      LibreOffice work without special mapping rules, which is also a speed
      Reviewers: #plasma, davidedmundson, broulik
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D4706
  20. 20 Feb, 2017 1 commit
  21. 17 Feb, 2017 3 commits
  22. 13 Feb, 2017 1 commit
    • David Faure's avatar
      TaskManager: add icon to cache after painfully querying it over XCB/NETWM. · 1f2a372f
      David Faure authored
      Hitting again a bug where switching desktops shows a delay of several seconds
      before the taskbar updates, I noticed that this code path was called 81
      times in 7 seconds (!) for kmail (maybe because I start it from cmdline
      rather than via a .desktop file).
      After the 4 slow calls to KWindowSystem::icon it seems definitely worth
      it to cache the result.
      Overall the main performance bug is still there though, switching
      desktops is still slow, but now all backtraces show QML triggered
      by model/view dataChanged signals, no idea yet, other than hoping
      for the pending QSFPM patches to help with this (no need to re-sort
      when the dataChanged roles are unrelated to the roles used for sorting).
      Reviewers: hein
      Reviewed By: hein
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D4600
  23. 09 Dec, 2016 1 commit
    • Eike Hein's avatar
      Refresh the ScreenGeometry data role whenever a screen is added or changes its geometry. · 0b0d1463
      Eike Hein authored
      As this happens the screen filtering higher up in the proxy chain
      culimating in TasksModel needs to be re-executed, as it compares
      ScreenGeometry against a property value set on the model. Without
      this update, tasks may disappear from views using TasksModel.
      Mapping the trigger conditions to affected rows is deliberately
      maximally coarse; see implementation comment in code.
      Reviewers: #plasma, davidedmundson
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D3628
  24. 14 Nov, 2016 1 commit
  25. 08 Nov, 2016 2 commits
    • Kai Uwe Broulik's avatar
      [XWindowTasksModel] Check for service being empty before searching new ones · 61860066
      Kai Uwe Broulik authored
      If our regular expression matching found a service but there was also some non-regular expression rule in the file,
      it would overwrite a potentially valid service match.
      CCBUG: 372211
      Differential Revision: https://phabricator.kde.org/D3309
    • Eike Hein's avatar
      Revamp Wayland application identification; align Wayland and X11 models · 273631af
      Eike Hein authored
      This adds support for app ids which are absolute paths to .desktop
      files to WaylandTasksModel, matching the heuristic in XWindowsTasksModel.
      Behavior between the two models is made more similar in various ways,
      such as matching codepaths for generating the ids inserted into the
      KActivities database in requestNewInstance/requestOpenUrls (also the
      X11 model was missing the notifyAccessed calls) and producing launcher
      Icons are still left to KWin however, instead of reading them from
      KService (which is what KWin does in any case on Wayland) or from the
      .desktop file. The latter might make sense, but to avoid duplicated
      code would then best be done in KWin.
      Reviewers: #plasma, graesslin, broulik
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D3292
  26. 07 Nov, 2016 2 commits
  27. 19 Sep, 2016 2 commits
    • Eike Hein's avatar
      Treat NET::Utility type windows as SkipTaskbar. · 7dee4619
      Eike Hein authored
      Utility windows (NET::Utility/_NET_WM_WINDOW_TYPE_UTILITY) should
      not be on the Task Manager, but they should be on the Pager. This
      patch achieves this by evaluating the window type in the
      AbstractTasksModel::SkipTaskBar data role.
      I considered the alternative approach of making a new
      AbstractTasksModel::IsUtilityWindow (or similar) data role and
      adding a pass to evaluate it to TaskFilterProxyModel, then
      configuring the filter models in TasksModel and the Pager backend
      differently. But this is not very extensible. Then I realized that
      AbstractTasksModel data roles do not and should not reflect X11
      idioms anyway; the point of the library is to abstract for the
      purpose of UI, and what XWindowTasksModel considers "SkipTaskBar"
      is really an implementation detail. This makes all the more sense
      considering on Wayland we have no notion of window types (beyond
      "popup") yet, and don't quite now how it's going to evolve.
      Various API docstrings have been changed to better reflect that
      the meaning of the data role doesn't map to anything specific in
      the tasks.
      Reviewers: #plasma, davidedmundson, broulik
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D2807
    • Eike Hein's avatar
      Add an ultimate fallback to WM_CLASS Class for AbstractTasksModel::AppId in XWindowsTasksModel. · 5e30fc60
      Eike Hein authored
      This makes grouping work for apps we can't find on the system and
      can't produce a launcher URL for, such as wine clients. Any better
      app will use our superior codepath, the wonky ones like wine then
      get left to making sure their WM_CLASS Class makes sense as per the
      ICCCM spec.
      Of course this doesn't work for XWayland clients on Wayland though.
      Also nixes an obsolete FIXME and adds a small check to avoid
      producing launcher URLs that are only the window icon pixmap
      query element.
      Reviewers: #plasma, davidedmundson, broulik
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D2804
  28. 06 Sep, 2016 1 commit
  29. 12 Aug, 2016 2 commits
  30. 29 Jul, 2016 1 commit
  31. 15 Jul, 2016 2 commits
  32. 13 Jul, 2016 1 commit
  33. 12 Jul, 2016 1 commit