F5F Stay Refreshed Software Operating Systems Ensure display preferences remain active after reboot.

Ensure display preferences remain active after reboot.

Ensure display preferences remain active after reboot.

J
Jostorak
Member
235
10-10-2023, 04:31 AM
#1
I secured a long HDMI cable so my computer could connect to the TV. Now I need the TV to replicate my main screen while an extra monitor is added. It’s been straightforward to craft the command (xrandr --output DVI-D-0 --output DP-1 --output HDMI-0 --same-as DP-1) to achieve that setup. Using NVIDIA X Server it’s even simpler. The issue is that disconnecting the cable or cable removal resets everything, forcing me to reconfigure. Is there a way for Ubuntu to handle this automatically when HDMI-0 is connected?
J
Jostorak
10-10-2023, 04:31 AM #1

I secured a long HDMI cable so my computer could connect to the TV. Now I need the TV to replicate my main screen while an extra monitor is added. It’s been straightforward to craft the command (xrandr --output DVI-D-0 --output DP-1 --output HDMI-0 --same-as DP-1) to achieve that setup. Using NVIDIA X Server it’s even simpler. The issue is that disconnecting the cable or cable removal resets everything, forcing me to reconfigure. Is there a way for Ubuntu to handle this automatically when HDMI-0 is connected?

S
Squidskull
Junior Member
14
10-16-2023, 05:35 PM
#2
A simple approach would be to use cron to regularly verify the device you need, and execute the command when it appears. You should expect roughly a one-second pause between connecting the display and it functioning properly. If you're interested in this method, explore cron and the lsusb utility from usbutils. I'll look for a more effective solution and return with an updated plan, but if it doesn't work, this should suffice.
S
Squidskull
10-16-2023, 05:35 PM #2

A simple approach would be to use cron to regularly verify the device you need, and execute the command when it appears. You should expect roughly a one-second pause between connecting the display and it functioning properly. If you're interested in this method, explore cron and the lsusb utility from usbutils. I'll look for a more effective solution and return with an updated plan, but if it doesn't work, this should suffice.