KDM: run xrandr *before* kdm_greet

Orion Poplawski orion at cora.nwra.com
Sat Apr 20 04:55:19 UTC 2013


On 04/19/2013 11:16 AM, Ian Pilcher wrote:
> My new laptop has the ability to support up to 3 concurrent displays.  I
> have found that this is actually a problem when I try to use it in my
> home office, where the (closed) laptop is placed into a docking station
> that is connected to two external displays.
>
> The default X behavior is to use both external displays *and* the built-
> in display.  Of course, the KDM login fields end up on the invisible
> built-in display.
>
> I can't use a static X configuration to work around this problem,
> because there are plenty of times that I'll want to use the built-in
> display.  I need to do this:
>
>    if /usr/bin/grep -q closed /proc/acpi/button/lid/LID/state; then
>        NUM_DISPLAYS=`/usr/bin/grep ^connected$
> /sys/class/drm/card0-*/status | /usr/bin/wc -l`
>        [ $NUM_DISPLAYS -gt 1 ] && /usr/bin/xrandr --output LVDS1 --off
>    fi
>
> (This disables the built-in display when the laptop is closed *and*
> there is at least one external display connected.)
>
> In theory I should be able to add this to /etc/kde/kdm/Xsetup, but it
> seems that kdm_greet is already running when this script is executed, so
> the theme geometry gets all messed up.  (My external displays do not
> have the same resolution as the built-in display.)
>
> For now, I've replaced /usr/libexec/kde4/kdm_greet with a wrapper script
> that does the xrandr stuff and then runs the actual program.  This is
> obviously fragile, however.
>
> Can anyone think of a better way to do this?
>
> Thanks!
>

I currently install the following as /etc/X11/xinit/xinitrc.d/nolvds.sh

#!/bin/sh
# Disable LVDS if another output is up
if xrandr --current | grep -qE '^(DVI|VGA).* connected'
then
    lvds=$(xrandr --current | awk '$1 ~ /LVDS/ { print $1 }')
    xrandr --output $lvds --off
fi

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion at cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com


More information about the kde mailing list