Skip to content

focus chain/scripting: Make list of most recently used windows public, and expose recently used and stacking order client lists in scripting API

Natalie Clarius requested to merge nclarius/kwin:expose-recently-used into master

It would be useful to have the list of windows in the order of recent usage available in the scripting API, rather than just allClientList. This would make it possible to e.g. in the minimize-all widget more reliably restore the windows in the correct order. I also have a use case for this in my Window Overlap Prevention script, where I want to reactivate the most recently used window after restoring some minimized ones.

Make the focus chain's list of recently used windows public, and use this as the clientList in the scripting workspace wrapper.

  • I am unsure if there is some architectural reason why making the focus chain's recently used windows list as a whole accessible from outside was not done in the first place, and piecing it together from the provided nextMostRecentlyUsed like tabbox does it is the way to go?
  • Would it be better to keep the scripting's current clientList, and instead add the list of windows in most recently used order (and while at it, another one in stacking order) as separate functions? I can't really think of a scenario where changing the client list to be ordered by recent usage would break existing scripts' functionality, and if I understand correctly, introducing it as a new feature would make it factually unusable for a long time if script developers want to ensure that their script works with older Plasma versions.

BUG: 409889

Edited by Natalie Clarius

Merge request reports