alias F2 shift -1
alias F3 shift 1
alias shift {
; 1: <1=left 0=same >1=right
;
var %wname, %wlist, %wtype, %ccid = $cid, %cwin = $active
var %a = 0, %aa = $scon(0), %c = 0, %cc = 0, %n = 0, %nwin = 0
while (%a < %aa) {
inc %a
scon %a
%c = 0
%cc = $window(*,0)
while (%c < %cc) {
inc %c
%wtype = $window(*,%c).type
if ($istok(chat custom fserv get send,%wtype,32)) continue
%wname = $window(*,%c)
inc %n
if ((%ccid == $cid) && (%cwin == %wname)) %nwin = %n
%wlist = $addtok(%wlist,$+($cid,.,%wname),44)
}
scon -r
}
;
if (%nwin == 0) {
%nwin = $findtok(%wlist,$wildtok(%wlist,$+($cid,.*),1,44),1,44)
%nwin = $calc(%nwin + $wildtok(%wlist,$+($cid,.*),0,44))
if ($1 > 0) dec %nwin
}
if ($1 < 0) {
dec %nwin
if (%nwin == 0) dec %nwin
}
elseif ($1 > 0) {
inc %nwin
if (%nwin == 0) inc %nwin
}
%nwin = $calc(((%nwin - 1) % $numtok(%wlist,44)) + 1)
;
%nwin = $gettok(%wlist,%nwin,44)
if (%nwin != $null) scid $gettok(%nwin,1,46) window -a $+(",$gettok(%nwin,2,46),")
}