Unable to set display layouts for sddm

Good Afternoon,

For a while now, I’ve been trying to disable one of the displays on my laptop on boot, so that it is off when SDDM is on the primary display, and if I want to use it, I manually turn it on once logged in. For context, my laptop, an Asus Zenbook Pro 15, has an extra display in place of the touchpad, of a similar size to a phone screen, that is useful for displaying content/sources on while working on the main screen.

The internal display outputs of this laptop are as follows:

  • eDP1 - the main display
  • HDMI-A-2 - the secondary touchpad display ‘screenpad’.

As previously stated, I’d like to have the screenpad turned off by default when the laptop boots. My current setup, using KDE plasma, has it turned off once I log in, with the following kscreen-doctor script linked to a keyboard shortcut to turn the display on or off as needed:

let
screenpadPort = "HDMI-A-2";
toggle-screenpad = pkgs.writeScriptBin "toggle-screenpad" ''
#!/usr/bin/env bash

disabled="$(kscreen-doctor -o | grep "${screenpadPort}" | egrep -o "disabled")"

if [ $disabled = "disabled" ]
then 
kscreen-doctor output.${screenpadPort}.enable output.${screenpadPort}.mode.0 output.${screenpadPort}.rotation.right output.${screenpadPort}.scale.2 output.${screenpadPort}.position.420,1080
else
kscreen-doctor output.${screenpadPort}.disable
fi
'';
in
{ environment.systemPackages = [toggle-screenpad];}

This script works, and is suitable for my needs once logged in. However, I have, as of yet, been so far unable to disable the screenpad when booting. I have so far tried the following:

services.xserver.displayManager.setupCommands="${lib.getExe pkgs.xorg.xrandr} --output eDP-1 --mode 3840x2160 --primary --output ${screenpadPort} --off";

and

services.xserver={
      xrandrHeads=[
        {
          output="eDP-1";
          primary=true;
        }
        {
          output="${screenpadPort}";
          monitorConfig=''Option "Enable" "false"'';
        }
      ];
      exportConfiguration=true;
};

However, neither has worked, and the screenpad remains on when sddm is displayed. This wouldn’t be so much of a big deal if the screenpad display was oriented correctly, however, Asus have used a display with a native portrait orientation, meaning that the screenpad is, by default, rotated by 90 degrees, hence the rotation in my toggle script.

What am I doing wrong in my configuration? How can I turn the screenpad off in SDDM (and ideally tty as well, but this may be a stretch)?
Thank you.

I took your code snippet and it worked for me disabling my second monitor on SDDM. Sorry I don’t have any help for why it wasn’t working for you. I’m on unstable so maybe something was fixed since you tried?

    xrandrHeads = [
      {
        output = "DP-1";
        primary = true;
      }
      {
        output = "DP-2";
        monitorConfig = ''Option "Enable" "false"'';
      }
    ];

I don’t have exportConfiguration set but I’m not sure how that could break something.