Add an identifier like $activewid that works like $active but returns the $wid of the currently active window.
$window($active).wid won't work for that since there can be multiple windows with the same name.
ya this would be a good addition, not that i currently need it, but only because it's not possible to script accurately (duplicate dcc windows of the same name for example) :X
Agreed, it would be nice to have it built-in. In the meantime, here's a workaround:
alias activewid {
var %i = 1
while $window($active,%i).wid {
var %w = @ $+ $v1, %c = $window(%w).sbcolor
window -g1 %w
if !$window(%w).sbcolor { return $mid(%w,2) }
window -g $+ $calc($findtok(message highlight event,%c,32)) %w
inc %i
}
}
Thanks qwerty, pretty clever
Agreed, very nice. (I have added this to my library of functions, even tho i dont currently have a use, better than trying to remember it later)
First use of a 6.17 addition i have seen, and solves the problem of $activewid with very little code being executed.
Not that you asked for it, but i cant really think of a use for $lactivewid, im sure there would be one, but i cant think of it.
I kind of thought of this now ...
on *:active:*:{
if ($lactive) { window -n $+(@,$lactivewid) }
mdi -t
}
My current workaround ...
on *:active:*:{
if ($lactive) {
scid $lactivecid
window -n $qt($lactive)
scid $activecid
}
mdi -t
}