KDM: run xrandr *before* kdm_greet

Ian Pilcher arequipeno at gmail.com
Fri Apr 19 17:16:03 UTC 2013


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!

-- 
========================================================================
Ian Pilcher                                         arequipeno at gmail.com
Sometimes there's nothing left to do but crash and burn...or die trying.
========================================================================



More information about the kde mailing list