How to prevent new windows from stealing focus?

  1. Install CompizConfig Settings Manager

    • either from Ubuntu Software Center
    • or via terminal:

      sudo apt-get install compizconfig-settings-manager
      
  2. Open CompizConfig Settings Manager and go to General -> General options -> Focus and raise behaviour

  3. Change the 'Focus prevention level' from 'Low' to 'Normal'.