You are not logged in.

#1 2010-10-09 12:03:38

Snip
Member
Registered: 2010-10-07
Posts: 3

Auto detect external monitor

Is it possible to have a script executed when I connect/disconnect my external monitor to my laptop (using a VGA cable)? I want to automatically execute xrandr to enable the external monitor and disable my laptop screen as soon as the cable is plugged in, and the other way around when it's unplugged. I can do it manually using the hotkey, but I'm just wondering wether this is possible as well.

Offline

#2 2010-10-09 12:07:03

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Auto detect external monitor

Latest xrandr has support from this (I've heard). Means you're out of luck if you're an nvidia user. Don't know whether the support has actually be implemented in the Intel driver (more likely) or radeon (less likely).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-10-09 12:08:57

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Auto detect external monitor

@ ngoonee
How about nouveau?

Offline

#4 2010-10-09 12:10:29

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Auto detect external monitor

karol wrote:

@ ngoonee
How about nouveau?

No idea, never got it to work well on my machine. This would be driver specific, the support (or otherwise) for xrandr's latest (probably 1.3).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#5 2010-10-09 14:37:29

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Auto detect external monitor

Snip wrote:

Is it possible to have a script executed when I connect/disconnect my external monitor to my laptop (using a VGA cable)? I want to automatically execute xrandr to enable the external monitor and disable my laptop screen as soon as the cable is plugged in, and the other way around when it's unplugged. I can do it manually using the hotkey, but I'm just wondering wether this is possible as well.

On a EEEpc I have:

CRT=`xrandr | grep "VGA1 connected"`
if [ "x${CRT}x" != "xx" ]; then
   xrandr --output LVDS1 --off --output VGA1 --mode 1680x1050 --pos 0x0 --rotate normal
fi

This has to be calibrated to the particular case, the value is not necessarily 'VGA1'.

And it will probably not work with the proprietary nvidia drivers.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#6 2010-11-13 23:16:16

mgzpac
Member
Registered: 2010-07-31
Posts: 18

Re: Auto detect external monitor

Are there any solutions for nvidia users?

Offline

#7 2010-11-14 14:43:47

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Auto detect external monitor

Bad idea unless you have tons of checks and fallbacks, otherwise you may get into a state where you end up with no image everywhere tongue


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2010-11-14 16:53:04

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

Re: Auto detect external monitor

mgzpac wrote:

Are there any solutions for nvidia users?

Not particularly; at least, not one that I've found.

However, I think a combination of disper (in the AUR) and assigning it to some keyboard shortcut(s) is a perfectly suitable alternative for most uses.


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

#9 2010-11-15 01:37:40

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Auto detect external monitor

Also auto-disper-git for reloading saved configs. There's no way I've found to automatically run the script though, I just bind it to a keyboard shortcut.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB