You are not logged in.

#1 2012-05-30 17:48:57

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

[SOLVED]Configure screen resolution for WM in multiple screen scenario

Hey there!

I've used xfce as DE for a while but I consider switching/trying a WM, i.e. awesome.

I'm using a Thinkpad T400 with a docking station connected to an Eizo FlexSan S2231W (I use the open source ati drivers). Until now xfce has taken care of setting the correct screen resolutions: if the notebook is connected to the dock and the lid is closed, the notebook monitor (LVDS) is disabled, only the external monitor is enabled and the correct resolution is set:

$ xrandr -q
Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192
DVI-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 297mm
   1680x1050      59.9*+
   1280x1024      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.3  
   640x480        60.0  
   720x400        70.1  
LVDS connected (normal left inverted right x axis y axis)
   1440x900       60.2 +
   1280x854       59.9  
   1280x800       59.8  
   1280x720       59.9  
   1152x768       59.8  
   1024x768       59.9  
   800x600        59.9  
   848x480        59.7  
   720x480        59.7  
   640x480        59.4  
VGA-0 disconnected (normal left inverted right x axis y axis)

When disconnected from the dock, the DVI output is disabled and the correct LVDS resolution is set. Apparently xfce stores this information in ~/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml: (note the diffrenent settings for "Default" and "MinimalAutoConfig")

<?xml version="1.0" encoding="UTF-8"?>
<channel name="displays" version="1.0">
  <property name="Default" type="empty">
    <property name="LVDS" type="string" value="Laptop">
      <property name="Active" type="bool" value="false"/>
      <property name="Resolution" type="string" value="1440x900"/>
      <property name="RefreshRate" type="double" value="60.153082"/>
      <property name="Rotation" type="int" value="0"/>
      <property name="Reflection" type="string" value="0"/>
      <property name="Primary" type="bool" value="false"/>
      <property name="Position" type="empty">
        <property name="X" type="int" value="0"/>
        <property name="Y" type="int" value="0"/>
      </property>
    </property>
    <property name="DVI-0" type="string" value="ENC 22&quot;">
      <property name="Active" type="bool" value="true"/>
      <property name="Resolution" type="string" value="1680x1050"/>
      <property name="RefreshRate" type="double" value="59.883253"/>
      <property name="Rotation" type="int" value="0"/>
      <property name="Reflection" type="string" value="0"/>
      <property name="Primary" type="bool" value="false"/>
      <property name="Position" type="empty">
        <property name="X" type="int" value="0"/>
        <property name="Y" type="int" value="0"/>
      </property>
    </property>
  </property>
  <property name="MinimalAutoConfig" type="empty">
    <property name="LVDS" type="string" value="Laptop">
      <property name="Active" type="bool" value="true"/>
      <property name="Resolution" type="string" value="1280x800"/>
      <property name="RefreshRate" type="double" value="59.810326"/>
      <property name="Rotation" type="int" value="0"/>
      <property name="Reflection" type="string" value="0"/>
      <property name="Primary" type="bool" value="false"/>
      <property name="Position" type="empty">
        <property name="X" type="int" value="0"/>
        <property name="Y" type="int" value="0"/>
      </property>
    </property>
    <property name="VGA-0" type="string" value="Bildschirm">
      <property name="Active" type="bool" value="true"/>
      <property name="Resolution" type="string" value="1280x800"/>
      <property name="RefreshRate" type="double" value="59.810326"/>
      <property name="Rotation" type="int" value="0"/>
      <property name="Reflection" type="string" value="0"/>
      <property name="Primary" type="bool" value="false"/>
      <property name="Position" type="empty">
        <property name="X" type="int" value="0"/>
        <property name="Y" type="int" value="0"/>
      </property>
    </property>
  </property>
</channel>

Of course, when starting an awesome session these configurations are not recognized ... Issuing these two commands brings me in my "docked/external monitor" configuration:

$ xrandr --output LVDS --off
$ xrandr --output DVI-0 --mode 1680x1050

However, I want X automatically recognize the situation (docked/undocked) and set the correct configuration. I know I've to set up a correct xorg.conf file but I don't know where to start, the man page really overwhelms me...

Any hints would be appreciated very much!

Thanks & regards

Last edited by ball (2012-05-31 14:10:23)

Offline

#2 2012-05-30 18:37:03

ZekeSulastin
Member
Registered: 2010-09-20
Posts: 266

Re: [SOLVED]Configure screen resolution for WM in multiple screen scenario

Offline

#3 2012-05-31 12:40:07

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: [SOLVED]Configure screen resolution for WM in multiple screen scenario

Thanks -- I've installed autorandr and saved profiles "docked" and "laptop". Loading the profile via "autorandr --change" works but I want to have the right resolution without typing this command or any shortcut issuing this command.

I tried to insert the command in ~/.xinitrc like this:

$ cat .xinitrc
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

# Disable bell in X
xset -b

DEFAULT_SESSION=startxfce4
case $1 in
    xfce4)
	exec startxfce4
	;;
    awesome)
	exec awesome
	exec autorandr --change
	;;
    *)
	exec $DEFAULT_SESSION
	;;
esac

But this doesn't have any effect when starting an awesome session... Any ideas how to automatically load the profile on startup?

Offline

#4 2012-05-31 13:19:42

Terminator
Member
From: Belgium
Registered: 2012-05-07
Posts: 265

Re: [SOLVED]Configure screen resolution for WM in multiple screen scenario

The 'autorandr --change' doesn't have any effect because you call it after starting awesome. Also, I think the call to autorandr should be without the exec:

autorandr --change
exec awesome

Offline

#5 2012-05-31 13:21:49

BurntSushi
Member
From: Massachusetts
Registered: 2009-06-28
Posts: 362
Website

Re: [SOLVED]Configure screen resolution for WM in multiple screen scenario

Instead of:

exec awesome
exec autorandr --change

Use

autorandr --change
exec awesome

Once "exec" is run, the current process exits. So anything after an "exec" command is discarded. See `man exec`.

As far as this process being automatic... It is possible by listening to RandR events or maybe udev, but I don't know of any tool that does this outside of desktop environments. Perhaps I will write one; but it is difficult to get the details worked out correctly.

Typically, people just assign a key binding to something like autorandr and hit it whenever the monitor configuration has changed. It's a pretty simple solution to what is probably complex automatic solution. (But maybe I'm missing something. It's early.)


Education is favorable to liberty. Freedom can exist only in a society of knowledge. Without learning, men are incapable of knowing their rights, and where learning is confined to a few people, liberty can be neither equal nor universal.

Tu ne cede malis sed contra audentior ito

Offline

#6 2012-05-31 13:48:29

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: [SOLVED]Configure screen resolution for WM in multiple screen scenario

BurntSushi wrote:

Use

autorandr --change
exec awesome

This works. Thanks.

BurntSushi wrote:

Typically, people just assign a key binding to something like autorandr and hit it whenever the monitor configuration has changed. It's a pretty simple solution to what is probably complex automatic solution. (But maybe I'm missing something. It's early.)

The problem here is, everytime awesome starts the wrong resolution is loaded, because autorandr doesn't make any changes to the resolutions permanent.

I wouldn't have any problems, if I'd to hit a key only whenever the monitor configuration has changed -- but the solution indicated by you seems to work for now...

Offline

Board footer

Powered by FluxBB