2

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?

balblua
  • 21
  • 1

1 Answers1

0

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"

jankes
  • 556
  • 2
  • 9