How can I set up my iphone to play sounds only when plugged in or an alarm is going off? I just got an iPhone 5 with iOS 6 and am struggling with all the different sound/vibration settings.  It seems like there are so many different ways to control this (up/down buttons on the left of the phone, the on/off toggle on the left, Settings --> Sound, and individual in-app settings).

Ideally what I want is for the phone to be silent (vibrate only) all of the time, except when:


I do something explicit to turn the volume on (e.g. I am playing a game or listening to music or something)
It is plugged in
An alarm goes off


What I specifically do NOT want:


The ringer to ever ring while the phone is in my pocket (i.e. 100% of the time it is not plugged in)
The alarm to ever NOT make a audible sound, regardless of any other volume/sound settings (e.g. if the answer is "flip the toggle switch on before you go to sleep and flip it off when you wake up," that's not good enough because I know I'll forget to do that and miss my alarm)


Is what I want possible?  What settings should I use?  Does this depend on the choice of alarm clock app?
Sound on iPhone is reasonably complicated when you get down and start "taking it apart". This is because it is managed on a very much case-by-base basis.

For example, if you call up Siri, and adjust the volume, it will only be adjusting the volume for Siri, not something like the ringer volume. 

So to divide things up and try to answer your question, I'll start with the basics. 

If you turn on Vibration mode (orange position) using the switch on the side of the phone it will turn off almost all sounds. Unlock, keyboards and such sounds will no longer be on. Notifications and phone calls will vibrate but not be heard. You will have to turn the switch off (no orange) in order to hear normal sounds while in apps - (i.e. games). When alternating vibration mode versus normal mode, iPhone remembers your previous state, and will set the volume to what it was before vibration mode was active.

Exception: alarms set in the Clock.app are still heard. In fact, there is no way to turn off Clock.app's alarms from being heard unless you turn off the alarm(s) itself. As for other alarm clock style apps (for example, Sleep Cycle), it is up to the developer to make it behave like Clock.app. That is the case with Sleep Cycle, but it would be worth verifying with any other alarm style app.

If you turn down the volume in the Music.app (or double tap home button and swipe to the right twice), or while watching a video, or in Settings.app, that is the volume that is applied across the board, mostly. That volume reflects the volume for videos, music, and apps that in general make noise - as in, games. Note that iPhone remembers your settings when you have headphones plugged in vs. not.

When iPhone is unlocked and you are on the home screen and you adjust the volume, you are adjusting ringer volume. In other words if the vibration switch is off (no orange) then that would be the volume it would ring at.

Do-not-disturb suppresses basically all notifications (there are some configuration options there). Again, alarms (from Clock.app, and other properly set up apps like SleepCycle) will stay play.

The only thing you can't do is have it toggle sound settings when it is plugged into the wall vs. when it is not. I think you will find it becomes habit, however, to throw the vibration switch.