This document outlines functionality, user interface design and considerations for improvements of screen management in Plasma.
Here are some examples of what kind of scenarios kscreen serves.
The user has a more or less static setup, for example two monitors next to each other on a desktop computer.
After installation, the user has to set the relative position of the displays, so the mouse cursor leaves one and enters another output on the physically adjacent edges. Ideally, he does this once, from then on, settings are stored and adjusted on login.
A laptop that is sometimes connected to a docking station with additional monitors connected.
Docking stations are basically multiple connections in one. Docking station-connected monitors are essentially the same as directly connected monitors, through HDMI, VGA, etc.. They're usually identified as DisplayPort connections. An interesting detail about docked monitors is that they might not show up until connected, so they might be either displayed, but disconnected (and thus not enabled), connected and enabled, or not present at all. Not displaying disconnected displays in the UI of course solved this dichotomy, at the technical level, it's handled correctly.
Kscreen restores previously saved settings when this docking station (and monitor) is connected. The use may close the lid of the laptop, in that case, all screen contents moves to the external monitor. (There's a setting to suspend the machine regardless, in that case, screen content isn't changed. Output connections are reconsidered post-resume and restored.
A projector is connected to a laptop to hold a presentation.
The key thing here is that an application such as Okular or libreoffice should use the projector and laptop display correctly. The fullscreen presentation goes to the primary monitor, preview and notes on the laptop screen. It shouldn't move an open email client or other application to the projector when it's plugged in, for example.
To understand how kscreen solves the above problems, it's helpful to understand how it roughly works under the hood. The user-visible components running on the user's system are a system settings module and a daemon that watches hardware changes and restores previously set configurations.
The config module in system settings is located under "Display and Monitor" -> "Display Configuration". It offers a drag-and-drop ui to position and set up displays. It allows to configure:
It also offers:
(0) The resolution control changes depending on the number of modes, if there's less than 16 sizes in it, it's displayed as slider, if there are more, it becomes a combobox. Interestingly, this makes the ui to set up either screen in the screenshots slightly different, depending on which one is selected (assuming one of the screens has more, and one less than 15 modes.
You can find screenshots of the current kscreen module here: https://phabricator.kde.org/M63
KScreen runs a daemon in the background, which does the following:
Kscreen's kded is not directly visible to the user, it doesn't have an OSD and doesn't prompt for anything.