nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   Laptop Docking : script to Change number of displays (http://www.nvnews.net/vbulletin/showthread.php?t=140105)

davidonlaptop 10-16-09 12:33 AM

Laptop Docking : script to Change number of displays
 
Hi!

I use two types of ServerLayout : one display (only laptop) and two displays (laptop + external monitor) and I like to make a script that applies the settings without rebooting the x-server.

The nvidia-settings can do it (in TwinView mode) but how to ask it to do it from a script?

packermann 10-16-09 01:59 AM

Re: Laptop Docking : script to Change number of displays
 
You could use disper (see posts in this forum). For the automatic switching you will have to use udev and write some rules. This depends on your hardware, what kind of events are triggerd when you dock.

davidonlaptop 10-16-09 09:41 AM

Re: Laptop Docking : script to Change number of displays
 
Quote:

Originally Posted by packermann (Post 2105363)
You could use disper (see posts in this forum). For the automatic switching you will have to use udev and write some rules. This depends on your hardware, what kind of events are triggerd when you dock.

Cool, I'll read on disper.

I am running Ubuntu 9.04 with a GeForce 8400M GS and a LG L204WT monitor. Where to look for the event? The videocard, the monitor the distro?

davidonlaptop 10-16-09 09:42 AM

Re: Laptop Docking : script to Change number of displays
 
I mean it's a not a real dock (ie: monitors, mouse, usb, etc.) are hooked up manually, is there still events generated in this case?

packermann 10-18-09 09:41 AM

Re: Laptop Docking : script to Change number of displays
 
You have to look yourself, if your machine generates some events. You could use udevadm for ths (http://linux.die.net/man/8/udevadm)

davidonlaptop 10-23-09 01:07 AM

Re: Laptop Docking : script to Change number of displays
 
Thanks I got disper working perfectly!

But can't figure out how to catch events for monitor hooking and unplugging.

I've follow this guide and tried :

Code:

sudo tail -f -n 0 /var/log/kern.log
sudo tail -f -n 0 /var/log/dmesg
sudo tail -f -n 0 /var/log/messages
sudo tail -f -n 0 /var/log/udev

I get absolutely no output for each of these commands, am I doing something wrong?

Here's the output of disper:
Code:

david@bangkok:~$ disper --list
display DFP-0: Seiko
 resolutions: 320x240, 400x300, 512x384, 576x432, 680x384, 640x480, 720x450, 640x512, 700x525, 800x512, 840x525, 800x600, 960x540, 1024x768, 1280x800
display CRT-0: LG L204WT
 resolutions: 320x240, 400x300, 512x384, 680x384, 640x480, 720x450, 700x525, 840x525, 800x600, 960x540, 832x624, 960x600, 1024x768, 1152x864, 1360x768, 1280x960, 1440x900, 1280x1024, 1400x1050, 1920x1080, 1680x1050

Any idea?

packermann 10-23-09 02:55 AM

Re: Laptop Docking : script to Change number of displays
 
Difficult to say. I'm not a udev-specialist and maybe your laptop isn't even generating any event when you are docking it into the station. I've bound disper to a key-combination, so I have to trigger it manualy.

davidonlaptop 10-25-09 11:18 PM

Re: Laptop Docking : script to Change number of displays
 
I wonder how can Window$ detect the second screen?

Oh well, how did you do your key combination, can you paste your config here?

packermann 10-26-09 06:27 AM

Re: Laptop Docking : script to Change number of displays
 
For getting Fn-F7 properply working on my thinkpad, I've followed http://www.thinkwiki.org/wiki/Sample_Fn-F7_script and afterwards I just bound disper in gnome-keybindings to this combination.

davidonlaptop 10-27-09 06:46 PM

Re: Laptop Docking : script to Change number of displays
 
Awesome!

Thanks packerman!

davidonlaptop 05-19-10 03:30 PM

Re: Laptop Docking : script to Change number of displays
 
Hey packerman, could you post your disper-modified version of the fn-f7 script ?

There seemed to be a lot of xrandr related stuff in there that doest not apply to disper.

packermann 05-20-10 01:40 PM

Re: Laptop Docking : script to Change number of displays
 
Nothing special, no need to hazzle with xrandr
Code:

#!/bin/bash
if [ $(disper -l | grep -c display) -eq "1" ]; then
        disper -s
else
        disper -e
fi

Save this to whatever you want, make it executable and bind it to a keycombination you like.


All times are GMT -5. The time now is 07:33 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.