5

Previously I used a linux system which didn't use Wayland and I was able to control my displays through the xrandr program. So to turn off my third display I used this command:

$ xrandr --output DP-1 --off

But now with Wayland this no longer works even if I use the new display names:

$ xrandr
Screen 0: minimum 320 x 200, current 5760 x 1200, maximum 8192 x 8192
XWAYLAND0 connected 1920x1200+1920+0 (normal left inverted right x axis y axis) 520mm x 320mm
   1920x1200     59.88*+
XWAYLAND1 connected 1920x1080+0+120 (normal left inverted right x axis y axis) 380mm x 210mm
   1920x1080     59.96*+
XWAYLAND2 connected (normal left inverted right x axis y axis)
   1920x1080     59.96 +

$ xrandr --output XWAYLAND2 --off
<nothing happens>

So is there a way to turn displays on and off on the command line when Wayland is used? I know I can control this in the gnome settings but I need to do it on the command line. So if there is some gsettings command to achieve this then this is also fine.

1
1

You can use wlr-randr to achieve this (https://github.com/emersion/wlr-randr).

List your displays/devices with one of those two commands:

$ ls /sys/class/drm

or

$ wlr-randr

And then run (where DP-1 is the name of the device/display) to turn it off:

$ wlr-randr --output DP-1 --off

(There's also a GUI friendly version like arandr which is named wdisplays https://github.com/cyclopsian/wdisplays)

1
  • 2
    Extra info, for sway (swaywm) users you don't need to install wlr-randr, you can use swaymsg instead: $ swaymsg -t get_outputs | grep 'name' $ swaymsg output DP-1 disable
    – jaumemk
    Nov 8 '20 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.