Move control file handling into Disman

Motivation

In the past KDisplay was responsible for saving files for

  • configs
  • outputs
  • additional control

and loading them when new outputs were connected or some were disconnected.

This has two severe disadvantages:

  • Additional control properties (for example replication source, scale in KWinFT or any "auto" values) are not always piped through the windowing system. They had to be written by KDisplay's KCM directly to the file system and picked up by the daemon with a file watcher. This was not synchronized with a potential simultaneous change passing through the windowing system.
  • The KDED daemon must run providing a KDisplay module to load updated configurations. This limits the usability of Disman as a potentially desktop environment independent display configuration utility.

Solution

  • We start all backends by default via Disman's D-Bus service what means there is a single D-Bus Disman instance per (D-Bus) session.
  • All additional control data is merged into the Config and Output API objects.
  • Disman sends on changes all control data (that means the config with outputs and additional control data) to all connected D-Bus clients.
  • All control file saving and loading is done by Disman.
  • Generating optimized configs is done by Disman.

Usage

  • At session start some random client must query once the current windowing system to startup Disman's D-Bus service that from then on manages the displays.
  • In a KWinFT/KWin session with Plasma this is done automatically by the KDisplay daemon.
  • In a wlroots session with sway or alike a single execution of disman-doctor -o is enough. This can be put in a startup-script.

Disman's automatic display management is active when the disman_backend_launcher process is running.

Further steps

  • We currently don't watch for control file changes because this costs resources and it might need synchronization with windowing system changes. But there are advantages:
    • This could be useful with multi-sessions (or reload on session activation?) to keep the control files and Disman's internal state synced.
    • Consumers that run Disman in-process (with env var and when no D-Bus available) could still update live to changes.
  • Some advanced functionality about laptops with closed lid and in docking stations is still in KDisplay and disabled for now. It would likely be nice to move this functionality also into Disman but it depends on powerdevil which Disman shouldn't depend on. It might be possible to use logind directly instead to query information about the current lid/docked state. Or at least the functionality must be fixed and enabled again in KDisplay.

Closes #5 (closed) #6 (closed) #10 (closed)

Merge request reports

Loading