Xrandr at login

Greetings!

I have two monitors with different resolutions, so at first login I have to open konsole and run following command for second monitor to set up properly:


xrandr --output DisplayPort-0 --auto --output HDMI-0 --auto --panning 3840x2160+3840+0 --scale 2x2  --right-of DisplayPort-0

This produces the desired result, but if i try to automate the process and place this command in .sh script then create a symlink to it, inside /etc/profile.d it does get executed but the end result is completely different - my second monitor is cut in half by a vertical invisible line so the outer half of the screen remains black and unusable. My desktop virtual space ends in the middle of the screen.

How to fix it and why that happens?!

If you want to automate this for a given user to take effect after login, add it as a startup script via System Settings > Autostart

When I want xrandr to configure multiple screens I put the symlink to the script in /etc/X11/xinit/xinitrc.d/. I’ve never tried combining panning with scaling though.

Because you mention ‘Konsole’ may we assume that your Desktop is KDE?
[HR][/HR]If it is then, the script should be placed in the “actions to be performed before KDE starts” directory: “~/.config/plasma-workspace/env/” …

Tried and still looks broken

Tried, looks broken but slightly differently - on the empty half of the screen shadowy image of the login animation remains

Yes, its KDE.

I think the problem is in the order of execution. For example I have scaling set in “Desktop” menu for both displays (apparently can’t be set just for one of them) and this scaling is loaded when I log in, however whichever of the above methods i try to run my script it seems to be executed before my desktop is even shown and all other settings applied and therefore the end result looks broken. I want my script to be ran last after i login or to be able to set delay without actually freezing the whole system on the login process waiting for that delay.

On Mon 29 Oct 2018 03:56:03 PM CDT, georgi7 wrote:

deano_ferrari;2884571 Wrote:
> If you want to automate this for a given user to take effect after
> login, add it as a startup script via System Settings > Autostart

Tried and still looks broken

mrmazda;2884573 Wrote:
> When I want xrandr to configure multiple screens I put the symlink to
> the script in /etc/X11/xinit/xinitrc.d/. I’ve never tried combining
> panning with scaling though.

Tried, looks broken but slightly differently - on the empty half of the
screen shadowy image of the login animation remains

dcurtisfra;2884680 Wrote:
> Because you mention ‘Konsole’ may we assume that your Desktop is
> KDE?
> If it is then, the script should be placed in the “actions to
> be performed before KDE starts” directory:
> “~/.config/plasma-workspace/env/” …

Yes, its KDE.

I think the problem is in the order of execution. For example I have
scaling set in “Desktop” menu for both displays (apparently can’t be set
just for one of them) and this scaling is loaded when I log in, however
whichever of the above methods i try to run my script it seems to be
executed before my desktop is even shown and all other settings applied
and therefore the end result looks broken. I want my script to be ran
last after i login or to be able to set delay without actually freezing
the whole system on the login process waiting for that delay.

Hi
Just add your command to ~/.profile file…


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
SLES 15 | GNOME Shell 3.26.2 | 4.12.14-25.22-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Background a script calling a “wait” statement and then the “xrandr” command by appending the control operator “&” to a call to the script within a script called by the KDE login process …

Still looks broken

As far as I understand i need to know which one is the login process in so i can track its ending.

Also my configuration is done entirely globally, so display settings configurable via systemsettings are entirely at their (null?) defaults. Maybe if you clear yours or try with a virgin user created for test purposes you will achieve the desired behavior. Disabling or uninstalling Plymouth might also help with that shadowy image, since without Plymouth it won’t be employed at all.

I dont mind it to work for all users - its my personal computer so there is only my account. However as i said i use the Displays menu or should i call it system menu to arrange how displays sit next to each other and mainly to just apply scaling. I noticed that at system boot, before login, scaling for the smaller, secondary display is different and changes once i login and settings in Displays got applied. Maybe i can find a way to run my script after login animation is been shown which probably means the scaling and other settings are already been applied and desktop is ready. All other attempts to run my script automatically makes secondary display cut in half before actual login animation is shown.

Have the spawned script calling “wait” and “xrandr” write the value of ‘$BASHPID’ (the PID of the Bash script’s process) to a (user’s) temporary file;
periodically check if the directory “/proc/«Bash script’s PID»” still exists (the ‘PID’ directory will disappear when the Bash script exits) …