What a coincidence, I just spent several hours messing with widget classes. I won't post my resulting code because it does stuff that is more complex and out of context for your question. Here are basics (or maybe "basics"):
- Widget is passed through
- Widget data is
- Sidebar name is
- Opening widget wrapper is
So you can filter this hook, check for sidebar you want to modify, keep track of widget count (likely with
static variable), modify wrapper and return modified widget parameters.
I am way to sleepy to write out specific code, leave a comment if you still need help with this and I will get back to it tomorrow.