Xfce Forum

Sub domains
 

You are not logged in.

#1 2012-03-16 07:06:26

rogerdean
Member
Registered: 2012-03-16
Posts: 2

How to auto switch monitor when laptop dock/undock?

Hello all

I'm a refugee from gnome, having a go with Wheezy XFCE. I have a Thinkpad X60s and dock with monitor.

When I dock the laptop I'd like the external monitor only to be active and at the right resolution, and when I undock I'd like the laptop screen to reactivate (which it doesn't at present). Right now I have a shortcut to Display prefs on my desktop, but I'm sure there must be a better way than this?

Any thoughts appreciated. Allbest
Roger

Offline

#2 2012-03-17 09:06:31

lifeinthegrey
Member
From: Seattle
Registered: 2012-01-17
Posts: 52

Re: How to auto switch monitor when laptop dock/undock?

Personally, I just use arandr to activate/deactivate monitors on the fly. Its not "automatic" persay, but it is certainly a simpler option than any other option I've seen. I use Wheezy XFCE as well.


oh, you want eXtremely Fast Computing? thats Easy ...

Offline

#3 2012-03-20 20:12:16

paolo321
Member
Registered: 2011-06-26
Posts: 121

Re: How to auto switch monitor when laptop dock/undock?

not sure about it... but I imagine that the "monitor connected" event could be detected someway (udev ???), and then it would be possible to run custom scripts with arandr ...

Just googled http://stackoverflow.com/questions/1430 … -connector ...
there are other interesting resources: https://encrypted.google.com/search?hl= … +connected

Last edited by paolo321 (2012-03-20 20:14:02)

Offline

#4 2012-03-21 06:15:16

lifeinthegrey
Member
From: Seattle
Registered: 2012-01-17
Posts: 52

Re: How to auto switch monitor when laptop dock/undock?

the monitor event theoretically COULD be detected someway, but basically that would involve constant polling (almost by the second, to register with the immediacy that most average users expect) the port to detect if there was a device connected or not. i cant speak with certainty on the issue because my coding experience only goes so far as web technologies, but i think its safe to say that constant background process of poll after poll would be quite resource intensive.


oh, you want eXtremely Fast Computing? thats Easy ...

Offline

#5 2012-03-21 16:04:08

eric_the_idiot
Member
Registered: 2011-12-23
Posts: 58

Re: How to auto switch monitor when laptop dock/undock?

http://www.signal11.us/oss/udev/
specifically "libudev - Monitoring Interface" would be of use.

Offline

#6 2012-03-27 07:02:32

rogerdean
Member
Registered: 2012-03-16
Posts: 2

Re: How to auto switch monitor when laptop dock/undock?

Thanks very much everyone, arandr for now I think, but I'll keep an eye on this thread in case something comes up
Cheers

Offline

#7 2012-04-07 11:40:39

oodavid
Member
From: Newcastle, UK
Registered: 2012-04-06
Posts: 16
Website

Re: How to auto switch monitor when laptop dock/undock?

After jumping ship from GNOME to Xfce I started down this route of automation like this but then realised it's not quite with the lightweight mantra of the system. Anyhow, I ended up with a pretty neat solution:

  • Install arandr

  • Create and save a layout for each of my setups

  • Add a monitor selection menu to my bottom panel for switching

  • Add a keyboard shortcut that runs "just the laptop monitor" that I can use in a pinch

Works REALLY well, if I unplug my main screen I can just CTRL+SHIFT+ALT+L and get just my laptop screen visible where I can then pick out a preset or setup a new monitor:

screenshot070412122321.png

Offline

#8 2012-04-08 20:17:31

paolo321
Member
Registered: 2011-06-26
Posts: 121

Re: How to auto switch monitor when laptop dock/undock?

It would be nice to merge/integrate xfce display settings and arandr, or maybe just to have a button in display settings to launch arandr , since these two are a bit "overlapping" ...

EDIT: following your idea, I've added a keyboard shortcut to "reset displays" that runs

xrandr --auto

Last edited by paolo321 (2012-04-09 14:24:31)

Offline

#9 2013-01-06 16:46:24

churchyard
Member
From: Prague [CZE]
Registered: 2008-01-29
Posts: 25
Website

Re: How to auto switch monitor when laptop dock/undock?

Sorry for bumping an old topic, but I was looking for the very same thing.

while true; do nice -n 19 xrandr --auto; sleep 2; done

Seems to work as expected and doesn't really take such a big load as I've hought.

Offline

Board footer

Powered by FluxBB