Error on enabling dual monitors by script

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
svendster

Error on enabling dual monitors by script

Post by svendster »

Hi,
I have Linux Mint 13 KDE 64-bit on a laptop and am trying to divide the screen across 2 monitors (i.e., the laptop screen & a montior).

I haven't been able to get it to divide the desktop across the 2 monitors using the SYSTEM SETTINGS.

I've experimented with the ARandR tool. When I tried to use it to create a new layout and then apply that layout, both screens turned black (in a weird way, with just the mouse cursor showing over the black background).

I tried saving that new layout and then ran it from the terminal. To my great surprise, that worked.

Code: Select all

#!/bin/sh
xrandr --output LVDS-1 --mode 1024x768 --pos 1024x0 --rotate normal --output DP-2 --off --output DP-1 --off --output VGA-1 --mode 1024x768 --pos 0x0 --rotate normal
However, when I rebooted and tried to run that shell script again, I got the following errors:

Code: Select all

mjolnir mjolnir # sh .screenlayout/new.sh 
No protocol specified
No protocol specified
Can't open display :0

Now, so far as I know nothing has been changed since that 1st successful execution.

Any idea what I need to do to execute that script?

Thanks in advance.

Svend
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
svendster

Re: Error on enabling dual monitors by script

Post by svendster »

I've made some major progress, but still have a problem.

I've found that this code works for me.

Code: Select all

export DISPLAY=:0
export XAUTHORITY=/home/[user]/.Xauthority
xrandr --auto --output VGA-1 --mode 1024x768 --right-of LVDS-1
However, my desk layout necessitates the monitor being to the left of the laptop.

When I execute
xrandr --auto --output VGA-1 --mode 1024x768 --left-of LVDS-1
I get a black screen.

Any idea what could be wrong?

Is the problem perhaps that the monitor needs to be designated the primary screen?

Thanks in advance.
Locked

Return to “Software & Applications”