The best way to accomplish this is to go to your laptop settings for Power and there is an option that says "Never go to sleep while plugged in" and choose that. It sets it so you still have your battery saving sleep mode while not plugged in, but as long as you have the laptop plugged in, it will never go into sleep mode.