I like the you are thinking... Been thinking about doing a similar thing myself.
Before you get too concerned about programming it though, I suggest you do some logging to understand its default operation. I think you might find that it pretty much operates as you want it to.
Let us know your results.
BMW - 135i DCT
Audi - Q5 3.0TDI