If you’ve encountered the challenge of wanting to extend your second monitor while mirroring your TV to your primary monitor, this tutorial will guide you through the process.
Step 1: Backup monitors.xml
Before making any changes, it’s always a good idea to create a backup of your current configuration. Open a terminal and enter the following command:
cp ~/.config/monitors.xml ~/.config/monitors.xml.backup
Step 2: Open the Configuration File
Now, open the monitors.xml configuration file with a text editor. In this example, we’ll use the Nano editor:
nano ~/.config/monitors.xml
Step 3: Locate the <logicalmonitor> Section
Within the configuration file, find the <logicalmonitor>
section that corresponds to the monitors you want to mirror.
Step 4: Adjust the Configuration
Move the <monitor>
part of one of the two monitors you want to mirror. Place it within the same <logicalmonitor>
section as the other one. Then, delete the <logicalmonitor>
section that only contains coordinates. Save your changes and reboot your computer.
Step 5: Troubleshooting
If, for any reason, your system encounters issues after making these changes and the graphical shell becomes unresponsive, you can still access the terminal. Here’s how:
- Accessing Terminal Without a Graphical Shell: If the graphical interface is not working, you can switch to a virtual terminal by pressing
Ctrl + Alt + F3
. This key combination will take you to a text-based terminal. To return to the graphical interface later, pressCtrl + Alt + F1
. - Restoring the Backup: Once in the terminal, navigate to the directory where you stored your backup:
cd ~/.config/
Restore your previous configuration:cp monitors.xml.backup monitors.xml
Reboot your computer:sudo reboot
Remember, creating a backup before making changes is always a good practice, providing a safety net in case anything goes wrong.
I hope this tutorial has been helpful.
This article has been crafted with the assistance of ChatGPT to enhance its clarity and readability.
Here is my final version of monitors.xml, as an example: