How do I set up different configurations on an Ubuntu laptop based on different physical locations?

2

I'm looking for a way to have a couple (or three) multiple configurations set up on my laptop, and easily switch between them. To be more specific, when my laptop is at work, it's plugged into a second monitor, and has a specific set of networks configurations. At home, the second monitor is gone, the network configurations are different. At a public wireless point there are other configurations to set, etc.

I know I can go into my preferences and turn on/turn off the monitor, and mess with the networking preferences, and so on, but I'm looking for a way to change a bunch of preferences all at once, and if it's possible to do that automatically, maybe based on the wireless APs in the vicinity, that would be even better.

Andrew Larned

Posted 2010-01-08T17:15:03.190

Reputation: 197

Answers

1

There are probably many ways to do this depending on your specifics, but here's one way. Put your configuration into ~/.xsessionrc. From there you can start xrandr to set up your screens and iwconfig for your network, or whatever. You could run iwlist or something similar to search for access points, but note that that will slow down your login process. So here is a rough example:

if sudo iwlist scan | grep -q 'ESSID:"xxx"'; then
   xrandr ...
   iwconfig ...
else ...
fi

Peter Eisentraut

Posted 2010-01-08T17:15:03.190

Reputation: 6 330