How to disable display output

If you have computer which has more than one graphic card, a problem can be monitor flickering when changing resolution. The problem can be solved at least two different way:

1. Make a startup script which turn off futile display ports

2. Make a /etc/rc.local file which turn off futile display ports

Way 1 script can be done using xrandr commands

My script in this computer

#! /bin/sh
xrandr --output VGA-0 --off
xrandr --output LVDS-1-1 --off
xrandr --output HDMI-1-0 --off
xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode LVDS 1368x768_60.00
xrandr -s 1368x768

Way 2 solution goes like

1. Check xrandr command output

2. Make a /etc/rc.local file like

1. Check rc-local status

sudo systemctl status rc-local

2. Make a rc-local service

sudo nano /etc/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

… save and quit

Ctrl o
Ctrl x

3. Make a /etc/rc.local file

printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local

sudo chmod +x /etc/rc.local

4. Enable and start rc-local

sudo systemctl enable rc-local

sudo systemctl start rc-local.service

sudo systemctl status rc-local.service

sudo nano /etc/rc.local

….. my contents

#!/bin/bash
xrandr --output VGA-0 --off
xrandr --output LVDS-1-1 --off
xrandr --output HDMI-1-0 --off
exit 0

Edit: The next way seems to be the best solution:

Run command

In Mate desktop

gsettings set org.mate.SettingsDaemon.plugins.xrandr active false

Cinnamon:

gsettings set org.cinnamon.settings-daemon.plugins.xrandr active false

Gnome:

gsettings set org.gnome.settings-daemon.plugins.xrandr active false

Found from:
https://askubuntu.com/questions/743473/how-to-disable-monitor-auto-configuration