1

Two screens are connected to the GTX1060: Monitor@DP-2 and TV@HDMI-0.

Problem

The screen configuration seems to default to HDMI as primary screen during reboot. Even after configuring the setup in Settings > Displays it resets with every reboot.

Login screen and desktop are all displayed on the TV while the monitor does not receive a signal at all.

What I want

The Monitor should be considered primary screen and the TV should be ignored regardless of the last sessions configuration.

Basically the following: xrandr --output HDMI-0 --off and xrandr --output DP-2 --mode 2560x1080 --rate 144.00.

Using shell scripts I can change the output automatically, but only after logging in (eg startup apps). How can I achieve this config before/during the login screen?

Additional Info

I use a python script that changes audio and video outputs to HDMI, so I can play games on the TV. Reverting the outputs to DP-2 and USBAudio works fine as well.

systemctl service fails as randr/X-Server are not ready yet(?). Adding After=display-manager.service did not work either.

jnnksdev
  • 121
  • See this comment: https://askubuntu.com/questions/1208933/cannot-set-display-options-inside-a-systemd-service#comment2029632_1208933 "The X server is not started until after a successful login." – Levente Jan 01 '21 at 14:15
  • Also, there is this fresh thread currently still without a working solution: https://askubuntu.com/q/1304086/1157519 It might offer further insight, plus hopefully it may get some updates soon. – Levente Jan 01 '21 at 14:19
  • @Levente yes, I was expecting that. I will add my findings to the thread as well – jnnksdev Jan 01 '21 at 14:26

1 Answers1

1

The file ~/.config/monitors.xml lists monitor configurations. My file had an incorrect configuration and the following content solved my problem:

<monitors version="2">
  <configuration>
    <logicalmonitor>
      <x>0</x>
      <y>0</y>
      <scale>1</scale>
      <primary>yes</primary>
      <monitor>
        <monitorspec>
          <connector>DP-0</connector>
          <vendor>GSM</vendor>
          <product>LG ULTRAWIDE</product>
          <serial>0x0003b343</serial>
        </monitorspec>
        <mode>
          <width>2560</width>
          <height>1080</height>
          <rate>144.00051879882812</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <disabled>
      <monitorspec>
        <connector>HDMI-1</connector>
        <vendor>SAM</vendor>
        <product>SAMSUNG</product>
        <serial>0x01000e00</serial>
      </monitorspec>
    </disabled>
  </configuration>
</monitors>

Note: Ports changed as I was experimenting with connectors.

jnnksdev
  • 121