Manjaro i3 make external monitor a mirror of my laptop screen not extension of my laptop screen


Hello everyone, i hope i make this worth your time. :slightly_smiling_face:
I am using a dell xps 13 9310, i have 5.13.19-2-MANJARO os running.
I have connected an external monitor to my laptop through the dell WDI9 dock.
Everything works well except the default behavior to treat an external monitor as an extension of my laptop screen is not ideal for my use.
Below are the results of running the command
xrandr Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384 eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 288mm x 180mm 1920x1200 59.95 + 59.88 47.96 1920x1080 60.01 59.97 59.96* 59.93 1600x1200 60.00 1680x1050 59.95 59.88 1400x1050 59.98 1600x900 59.99 59.94 59.95 59.82 1280x1024 60.02 1400x900 59.96 59.88 1280x960 60.00 1440x810 60.00 59.97 1368x768 59.88 59.85 1280x800 59.99 59.97 59.81 59.91 1280x720 60.00 59.99 59.86 59.74 1024x768 60.04 60.00 960x720 60.00 928x696 60.05 896x672 60.01 1024x576 59.95 59.96 59.90 59.82 960x600 59.93 60.00 960x540 59.96 59.99 59.63 59.82 800x600 60.00 60.32 56.25 840x525 60.01 59.88 864x486 59.92 59.57 700x525 59.98 800x450 59.95 59.82 640x512 60.02 700x450 59.96 59.88 640x480 60.00 59.94 720x405 59.51 58.99 684x384 59.88 59.85 640x400 59.88 59.98 640x360 59.86 59.83 59.84 59.32 512x384 60.00 512x288 60.00 59.92 480x270 59.63 59.82 400x300 60.32 56.34 432x243 59.92 59.57 320x240 60.05 360x202 59.51 59.13 320x180 59.84 59.32 DP-1 disconnected (normal left inverted right x axis y axis) HDMI-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) DP-3 disconnected (normal left inverted right x axis y axis) DP-4 disconnected (normal left inverted right x axis y axis) DP-1-1 disconnected (normal left inverted right x axis y axis) DP-1-2 disconnected (normal left inverted right x axis y axis) DP-1-3 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 598mm x 336mm 1920x1080 60.00*+ 74.97 50.00 59.94 1680x1050 59.88 1600x900 60.00 1280x1024 60.02 1440x900 59.90 1280x800 59.91 1280x720 60.00 50.00 59.94 1024x768 60.00 800x600 60.32 720x576 50.00 720x480 60.00 59.94 640x480 60.00 59.94 720x400 70.08
My goal is to make screen DP-1-3, the external monitor my main display when that external screen connected and my laptop display, screen eDP-1 my main display when
no external display is connected. Is this possible? And if so how can i achieve the desired behavior? Thank you!

You could install and use arandr. I do it every time I connect a second screen while using i3. That’s one reason why I so often try if sway has become a full replacement of i3. While using sway, I never have to do anything but connect the device.

Thank you for replying to this, however i am already using ARandR, I am completely new to it and i am not sure how to configure it for my specific needs. Any help there would be highly appreciated. Thanks!

The problem is, that you have to use it every time if you aren’t smarter than me and found out how to configure it right down somewhere. What I did was to find in arandr, which devices are connected, chose the right solutions for them and than place theme in the order you want in the window below the menu.
Otherwise, I just found Look if you could use this and make it work for your case.

Thank you for taking the time to respond to this. I found something that sorta works for now, the problem is i have to reboot my machine every-time i change from docked(using a docked station) to mobile(my laptop alone display).
first i created a bash script that basically looks to see how many screens are connected and depending on the response, it does something different each time.

  1. i3 config file
  2. bash file below or your edited version
  3. autorandr. click link for instructions on how to install autorandr
  4. another simple bash-script

Its a very simple script, it works for what i want and you can edit it to fit your specific use case.
1.install autorandr and save the different screen configurations, i.e
i. without any dock or external monitor connected

 autorandr --save <laptop>

ii. with dock or external displays connected
for this step above, you need to first execute the first bash script pasted directly below this. This will load the configuration to set this as a

#!/usr/bin/env bash

# extern=DP-1-3

connected=$(xrandr | grep " connected" | wc -l)
extern=$(xrandr | grep " connected" | grep -v "$intern" | cut -d' ' -f1)

# If there's more than one screen connected...
if [[ $connected -gt 1 ]]; then
	# Turn off $intern
	xrandr --output "$intern" --off --output "$extern" --auto
	# Turn off $extern
	xrandr --output "$extern" --off --output "$intern" --auto

  1. save this setup with the command below
 autorandr --save <docked>

  1. you can then switch between the mode you want manually using the commands on your terminal
autorandr --change

Your are allowed to stop here if this set up works for you.
I wanted to do this automatically without having to do much. I had two choices to make at this point,

  1. configure and bind keys with the command above to reload this automatically when i use certain key combinations
  2. configure my i3 config file to decide what combination to use on start up.

I decided to go for option 2.
for that i set up the bash script below

#!/usr/bin/env bash

# extern=DP-1-3

connected=$(xrandr | grep " connected" | wc -l)
extern=$(xrandr | grep " connected" | grep -v "$intern" | cut -d' ' -f1)

# If there's more than one screen connected...
if [[ $connected -gt 1 ]]; then
    autorandr --change
    autorandr --load mobile

this basically checks if i have more than 1 display showing and chooses what to use based on that.
I then added this line to my i3 config file and i was done and ready.

exec_always --no-startup-id  <path/to/script/above> 

The behavior is such that i have to restart my machine after changing display so as to choose the next most suitable display.

This is a work around, anyone with a better solution, feel free to post it, but for now i will mark this as solved.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.