You are not logged in.

#1 2016-03-28 22:00:43

Gradient
Member
Registered: 2013-05-19
Posts: 101

[Solved] xrandr command in .xinitrc not applied for some DE

I have this command in my .xinitrc (before exec...) (to choose a display):

xrandr --output VGA1 --primary --output LVDS1 --off

Then, I tested with exec startkde and exec cinnamon-session and it is not applied (both displays are used). It works with exec startxfce4. I suspect kde and cinnamon reconfigure displays after X is started. LVDS1 is broken, so I can not fix this from within kde. How can this be fixed before X is started?

Last edited by Gradient (2016-03-29 01:04:28)

Offline

#2 2016-03-28 22:36:37

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: [Solved] xrandr command in .xinitrc not applied for some DE

I don't really get your situation. Do you mean that the physical monitor LVDS1 is broken, that the DE defaults to this broken monitor and that because of that you can't interact with it once it has started?

Stupid question perhaps, but does it apply correctly if the command gets executed after the DE has started? If so, configuring your DE to autostart the command may help out. A more quick and dirty fix (if you only need it once) would be:

{ sleep 5; xrandr --output VGA1 --primary --output LVDS1 --off } &
exec startkde

The DE should start during the sleep, so you may have to increase the sleep time depending on how fast it gets started.

EDIT: If that doesn't work you'll have to dive into the DE's settings.

Last edited by Steef435 (2016-03-28 22:39:55)

Offline

#3 2016-03-28 23:52:27

Gradient
Member
Registered: 2013-05-19
Posts: 101

Re: [Solved] xrandr command in .xinitrc not applied for some DE

I don't really get your situation. Do you mean that the physical monitor LVDS1 is broken, that the DE defaults to this broken monitor and that because of that you can't interact with it once it has started?

Yes, that is what I meant.

Your command also works and fixes my problem, except that I need to write is that way :

{
sleep 5; xrandr --output VGA1 --primary --output LVDS1 --off
} &
exec startkde

Any idea why I need linebreaks after and before { and }?

Offline

#4 2016-03-29 00:02:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,546
Website

Re: [Solved] xrandr command in .xinitrc not applied for some DE

Use parenthesis instead of brackets, or put a semicolon at the end of the xrandr command and you will not need the newlines.

Curly braces is better in bash (no extra subshell).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2016-03-29 23:28:38

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: [Solved] xrandr command in .xinitrc not applied for some DE

Ah, my bad, I'm a zsh user myself and didn't test it in bash properly (sh is still bash in my head). Glad to see you solved it.

Offline

Board footer

Powered by FluxBB