Home » Questions » Computers [ Ask a new question ]

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

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

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.

Asked by: Guest | Views: 63
Total answers/comments: 1
Guest [Entry]

"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"