12

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 Answer 1

3

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)

3
  • 7
    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, 2020 at 0:12
  • 7
    "compositor doesn't support wlr-output-management-unstable-v1". Bah. Which compositors do that? Jul 12, 2022 at 16:53
  • wdisplays seems dead. Jul 17, 2023 at 4:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .