20

Is there a possibility to configure the monitor configuration of Mutter/GNOME shell from command line in a Wayland Session or is that not implemented until now?

I have tried to change some things via the xrandr command (but it seems obvious to me, that this can not work as the "x" in xrandr indictates that it is a tool for the XServer).

This command has no effect (using Fedora 23 / GNOME 3.18.2)

xrandr --output XWAYLAND0 --off

However the included gnome settings dialog for the display configuration is working. A hint to a configuration file or a command line tool would be nice...

6
  • 1
    wiki.gnome.org/Initiatives/Wayland/Gaps/DisplayConfig Commented Apr 9, 2016 at 12:39
  • Could KMS or DRM be used for this? I've been searching but have yet to find any solution. I also need to be able to toggle a display without going trough the settings. Commented Nov 17, 2016 at 23:08
  • 1
    I think in the end i came up with a hacky solution through a dbus command line client... The link don_chrissi posted provided some hints about that. Maybe there is by now also a command line version available... Commented Nov 17, 2016 at 23:39
  • 1
    Could you share your solution? Commented Mar 5, 2017 at 20:33
  • 1
    Consider using this python script. Commented Jan 6, 2020 at 16:16

2 Answers 2

10

The Mutter docs specify the interface with dbus as @don_crissti has pointed out in comments:

https://gitlab.gnome.org/GNOME/mutter/blob/master/src/org.gnome.Mutter.DisplayConfig.xml

You need to find out your configuration serial and your connector:

configuration serial is the first number shown in

gdbus call \
--session \
--dest=org.gnome.Mutter.DisplayConfig \
--object-path /org/gnome/Mutter/DisplayConfig \
--method org.gnome.Mutter.DisplayConfig.GetResources

in my case that is uint32 3, so I use 3

connector: it shows in ls /sys/class/drm, in my case by trial and error I found that card0-DP-2 was the correct one so I use DP-2. You can also try to make sense of the output of DisplayConfig.GetResources and use that.

By setting the other options, the final command becomes like this:

gdbus call \
--session \
--dest=org.gnome.Mutter.DisplayConfig \
--object-path /org/gnome/Mutter/DisplayConfig \
--method org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig \
3 1 "[(0, 0, 1, 0, true, [('eDP-1', '[email protected]', [] )] )]" "[]"

Unfortunately, that does not work for me, even though I am passing the resolution (aka. "mode id") in the right format:

Error: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid mode '[email protected]' specified
(According to introspection data, you need to pass 'uua(iiduba(ssa{sv}))a{sv}')

EDIT:

I found why, the refresh rate needs to be THE EXACT STRING that DisplayConfig.GetResources is reporting. It does not let you set what you want as refresh rate sadly! So you have to use some arbitrary string like 59.810825347900391 like so:

gdbus call \
--session \
--dest=org.gnome.Mutter.DisplayConfig \
--object-path /org/gnome/Mutter/DisplayConfig \
--method org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig \
3 1 "[(0, 0, 1, 0, true, [('eDP-1', '[email protected]', [] )] )]" "[]"

In conclusion, this is of very limited use. There should be a way of adding display modes, by generating CVT or GTF timings, but it looks like DisplayConfig does not have an interface for that :(

0

I use

busctl --user \
call org.gnome.Mutter.DisplayConfig /org/gnome/Mutter/DisplayConfig \
org.gnome.Mutter.DisplayConfig GetCurrentState \
--json short

["[email protected]",3840,2160,6.000000000000000000000e+01,1.000000000000000000000e+00,[1.000000000000000000000e+00,2.000000000000000000000e+00,3.000000000000000000000e+00,4.000000000000000000000e+00]

for get correct mode "[email protected]"

2
  • This only shows the current mode, doesn’t it? The question is about changing it. Commented Oct 21 at 16:58
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. Commented Oct 21 at 19:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.