Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Ubuntu laptop gets docked into a few different locations per day with different hardware and use cases. I'd like to automate the preference settings for each of these locations:

  • Work computer, dual head 1280x1024
    External USB audio and bluetooth audio
  • Home computer, dual head 1280x1024, 1080p
    External USB audio

Basically, when I dock the box in either (1) or (2), I want to automagically get the right xrandr settings for the different screen geometries and the right audio routing.

What scripts, etc. are responsible for the inscrutable default behavior?

Are there packages for customizing this?

If I wanted to roll my own, what is the right library to use to catch the hotplug events?

share|improve this question

The best way to accomplish this is, in my view, is via udev rules. Udev is a deamon that detects hardware being connected an preforms specific tasks upon such events. Google for "writing udev rules" and pick tutorials that best fit your case.

In short, the rules ale placed in files under /etc/udev/rules.d/ and cover a variety of hardware related events. The ones you'd be writing would probably always end in RUN+="/path/to/your/script --with its --parameters"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.