if (word(2 $loadinfo()) != [pf]) {
	load -pf $word(1 $loadinfo());
	return;
};

#	Copyright (c) 2005 David B. Kratter (BlackJac@EFNet)
#
#	Version: 1.5.2005.04.20.1
#
#	This will allow you to toggle between hidden windows 1 through 20 more
#	easily. Press Esc+1 (or Alt+1) to toggle between windows 1 and 11,
#	Esc+2 for windows 2 and 12, etc., up through Esc+0 for windows 10 and
#	20. You may also use Esc+? to be prompted for a window number. Press
#	Esc+- (or Alt+-) to swap to the previous hidden window, or Esc+= to
#	swap to the next hidden window.

package altchan;

alias altchan.input (void) {
	input "$banner Switch to which window \(currently $winnum()\)? " {
		if (strlen($*)) {
			altchan.toggle $0;
		};
	};
};

alias altchan.toggle (number, void) {
	if (@number) {
		if (number == 0) {
			@ :window = winnum() == 10 ? 20 : 10;
		} else {
			@ :window = number == winnum() ? number + 10 : number;
		};
		if (winnum($window) != -1) {
			window refnum_or_swap $window;
		} else {
			xecho -b -c Window $window does not exist;
		};
	};
};

fe ($jot(0 9 1)) aa {
	@ bindctl(sequence ^[$aa set parse_command altchan.toggle $aa);
};

@ bindctl(sequence ^[- set parse_command window previous);
@ bindctl(sequence ^[= set parse_command window next);
@ bindctl(sequence ^[? set parse_command altchan.input);
