Jump to content

Possible to auto switch single/dual screen setup?


holr
 Share

Recommended Posts

Hi,

I have been running beryl 2.0 very nicely on my ibm t43p laptop (ati graphics card) for a while now. Even managed to get dual screen running on it too (by limiting the total width of the two screens to 2048). However, I have two "profiles", one, where I am in the office, I use the dual screen setup - a custom xorg.conf forcing the two monitors to 1024x768 (as my graphics card only has a maximum texture size of 2048 - "glxinfo -l grep TEXTURE_SIZE). When I am anywhere else, I need to use just the one screen on the laptop, which has a native resolution of 1400x1050. For which needs another xorg.conf not limiting it to 1024x768.

 

When I boot the system in single display mode, the xorg.conf is still hard-coded for the low resolution of 1024x768 and dual screens, as such, I manually drop down into the command line every time to switch between two different xorg's.

 

Is there a way of automatically querying the monitors, before X loads up proper, and based on the outcome, replacing the xorg.conf with the one best suited (i.e. a "single screen" xorg.conf if only one monitor is found, a "dual screen" xorg.conf if an external is found etc).

 

I know with aticonfig you can query which monitors are connected, but as this can only be run once X has loaded, it does seem a bit redundant....

Link to comment
Share on other sites

One way of switching from one xorg.conf to another is by setting up several boot profiles in lilo. You can create two boot profiles in /etc/lilo.conf and add PROFILE=profile1 and PROFILE=profile2 to the append insruction. You must run the command

lilo -v

as root every time you change lilo.conf. It is then possible to poll the current profile from /etc/rc.local by looking at the content of the file /etc/netprofile/current and change the content of xorg.conf accordingly. You don't even need to change the file itself, symlinking xorg.conf to xorg.conf.dual_screen or xorg.conf.internal_lcd should do the trick.

 

Check the location of all files mentioned before you start doing anything, they might be in a different location or have a different name - my system is not the latest one.

Link to comment
Share on other sites

I thought you could include bash code in .xinitrc

in your home folder

 

maybe also /etc/rc.local if that is run before X (cannot remember for sure)

so you could ask a question there as well

Correct, but the script must somehow find out which X profile needs to be loaded. If there were a way to autodetect the number and type of monitors connected from within a bash script, that would be easy, but I am not aware of such a thing.

Link to comment
Share on other sites

autodetect the number and type of monitors connected

I was just thinking of use choosing profile 1 or 2 at boot

SUrely he/she will now how many monitor are present that day

hence

so you could ask a question there as well

 

I like the lilo solution, I was just thinking at what lower level, last chance, to do the choice

 

autodetect the number and type of monitors connected from within a bash script, that would be easy, but I am not aware of such a thing

good question... never thought of that

I know Xorg.0.log tell you what screen was detected

so one would need to start X do some magic with grep with Xorg.0.log

then restart X with the right profile...

Cannot think of anything else

surely that info can be accessed via command lshw or via /proc

I do not know

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...