Skip to content

Save and restore position of main window

Nate Graham requested to merge work/ngraham/save-window-positions into master

This commit invokes the new KWindowConfig::saveWindowPosition() and KWindowConfig::restoreWindowPosition() added to KConfig in kconfig!14 (merged). As a result, KDE apps using KXMLGui now automatically save and restore the positions of their windows on a per-screen-arrangement basis.

This only affects the main window; sub-windows and dialog windows seem like they will need to be handled on an app-by-app basis as most apps currently manually invoke KWindowConfig::saveWindowSize() and KWindowConfig::restoreWindowSize() for those windows, and they will need to be ported to also invoke KWindowConfig::saveWindowPosition() and KWindowConfig::restoreWindowPosition()` in the same places.

BUG: 415150 FIXED-IN: 5.74

Test Plan

  1. Open Dolphin
  2. Move its main window somewhere else on screen
  3. Close it
  4. Re-open it

See that it opened in the same position where you closed it!


  1. Do the same thing with Kate Okular, Konsole, and Spectacle

See that the same works for all of them too!


  1. Plug in a second screen and move the main window of one of those apps to the second screen
  2. Close that app and re-open it

See that it opened in the same position on the other screen!


  1. With the second screen still plugged in and one of those apps on the second screen, close that app
  2. Unplug the second screen
  3. Open that app again

See that it opened in the same position on the first screen that it opened in before the last time only this screen was active!

Edited by Nate Graham

Merge request reports