Yeah it's the best you can do for now I guess. Btw, instead of setting a %var to $active you can use $lactive. Also, the window name should be enclosed in quotes, in order to work properly for window names of more than 1 word:
window -xr <windowname>
window -a $+(",$$lactive,")