You are not logged in.

#1 2017-10-22 14:05:12

Xwang
Member
Registered: 2012-05-14
Posts: 353

Disabling internal monitor if external is connected during boot

I have a laptop connected to an external monitor with HDMI and I would like to see the boot process only on the external monitor when it is connected.
Now it flickers between the external and internal monitors and the greeter SDDM is displayed on both monitors.
After login this startup script (/usr/local/bin/toHDMI2Monitor.sh):

#!/bin/sh

IN=$(xrandr | grep "eDP" | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")
EXT=$(xrandr | grep "HDMI" | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")

if (xrandr | grep "$EXT disconnected"); then
    xrandr --output $EXT --off --output $IN --auto
else
    xrandr --output $IN --off --output $EXT --auto
fi

solves the problem.

Adding this line /bin/bash /usr/local/bin/toHDMI2Monitor.sh at the end of /usr/share/sddm/scripts/Xsetup, I've managed to disable the internal monitor if the external monitor is connected before the execution of SDDM, which now appears only on one monitor.

In any case it will be nice to be able to have the internal monitor disabled during the boot phase (as windows 10 on the same laptop does).


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

#2 2017-10-22 22:35:44

fuyuki
Member
Registered: 2017-10-20
Posts: 23

Re: Disabling internal monitor if external is connected during boot

Nice work!

It'd probably be good to stick (Solved) on the title too, yeah? You did write a solution, after all.


Arch | amd64 | rEFInd | OpenRC | MATE | PulseAudio

Offline

#3 2017-10-22 22:37:13

Xwang
Member
Registered: 2012-05-14
Posts: 353

Re: Disabling internal monitor if external is connected during boot

fuyuki wrote:

Nice work!

It'd probably be good to stick (Solved) on the title too, yeah? You did write a solution, after all.

Not completely because the boot process (till SDDM is loaded) still appears on both monitors.


I'm still learning English so please excuse me if my English is not good enough and feel free to correct me via PM if you want.

Offline

#4 2017-10-22 23:49:35

fuyuki
Member
Registered: 2017-10-20
Posts: 23

Re: Disabling internal monitor if external is connected during boot

Xwang wrote:

Not completely because the boot process (till SDDM is loaded) still appears on both monitors.

I think you could disable the internal display through grub config in that case. If you use a different bootloader, though, I'm not so sure--but before your DM starts, you have no X, so Xsetup won't help, AFAIK.

Kernel mode setting might also be able to do it... though the bootloader (obviously) acts earlier, so if you want it to be off the whole time, I'd go that route.

I think you might also need to manually reenable the device through a second script if you disable it through grub (though this depends on exactly how the kernel, X and your WM/DE, etc. handle it), so keep that in mind. Worst case, you may need to script it to be off in both grub and KMS, then reenable it when your session starts.

Last edited by fuyuki (2017-10-22 23:58:53)


Arch | amd64 | rEFInd | OpenRC | MATE | PulseAudio

Offline

Board footer

Powered by FluxBB