Regarding the outputdevice Wayland protocol
Sebastian Kügler
sebas at kde.org
Wed Nov 8 15:17:24 UTC 2017
Hi Drew,
On woensdag 8 november 2017 15:12:03 CET Drew DeVault wrote:
> Thanks for the info, guys!
>
> My main use-case for this protocol is to be able to share an
> arandr-like tool between KDE and any compositor using wlroots (Sway,
> way-cooler, waymonad, etc).
>
> Did you guys write a screen configuration tool that leverages this
> protocol? Can it be easily detached from the rest of KDE?
Yes, we did.
We have a library (libkscreen) which has backends for xrandr and
wayland). It uses our kwayland frameworks (which is a wayland
abstraction and depends on Qt). libkscreen has a high-level screen
management API. In Plasma, there's a systemsettings module, which
probably is a bit too Plasma specific for your case), but libkscreen
also contains a command-line program (called kscreen- doctor) that
allows screen configuration, it looks like this:
iro.sebas(~/.config/QtProject): kscreen-doctor
--help [15:53:58]
Usage: kscreen-doctor [options] [output.<name>.<setting>
output.<name>.setting [...]]
kscreen-doctor allows to change the screen setup from the command-line.
Setting the output configuration is done in an atomic fashion, all
settings are applied in a single command.
kscreen-doctor can be used to enable and disable outputs, to position
screens, change resolution (mode setting), etc.. You should put all
your options into a single invocation of kscreen-doctor, so they can
all be applied at once.
Usage examples:
Show output information:
$ kscreen-doctor -o
Output: 1 eDP-1 enabled connected Panel Modes: Modes: 1:800x600 at 60
[...] Geometry: 0,0 1280x800
Output: 70 HDMI-2 enabled connected HDMI Modes: 1:800x600 at 60 [...]
Geometry: 1280,0 1920x1080
Disable the hdmi output, enable the laptop panel and set it to a
specific mode
$ kscreen-doctor output.HDMI-2.disable output.eDP-1.mode.1
output.eDP-1.enable
Position the hdmi monitor on the right of the laptop panel
$ kscreen-doctor output.HDMI-2.position.0,1280
output.eDP-1.position.0,0
Set resolution mode
$ kscreen-doctor output.HDMI-2.mode.1920x1080 at 60
Options:
-h, --help Displays this help.
-i, --info Show runtime information: backends, logging, etc.
-j, --json Show configuration in JSON format
-o, --outputs Show outputs
-d, --dpms <off> Display power management (wayland only)
-l, --log <comment> Write a comment to the log file
Arguments:
config Specific output settings are separated by
spaces, each setting is in the form of
output.<name>.<setting>[.<value>]
For example:
$ kscreen-doctor output.HDMI-2.enable \
output.eDP-1.mode.4 \
output.eDP-1.position.1280,0
Multiple settings are passed in order to have
kscreen-doctor apply these settings in one go.
libkscreen can be used to create a GUI to manage screens.
There's also a Plasma specific daemon which tracks screen configuration
changes and handles hotplugging (it detects plugged and unplugged
screens and then applies a config that the user has previously set up.
It also does some sensible things around lid close and suspend events.
kwayland and libkscreen are unit-tested, libkscreens xrandr backend's
unit tests are somewhat spotty, but the wayland / kwayland coverage is
actually really good, since it's much easier to synthesize a wayland
server than an X11 server, and the protocols are of course much more
reliant.
If you have any questions, please let me know.
Cheers,
--
sebas
http://www.kde.org | http://vizZzion.org
More information about the Plasma-devel
mailing list