#!/bin/bash

tmux list-sessions |
grep -qE '^osd-' ||
	tmux -2u new -dt osd

{ cat <<EOF
0000 Black
0000 Black
0000 Black
0000 Black
ffff Regular
EOF
} |
while read fc fn; do
	args=(
		-depth 32
		-bg rgba:0000/0000/0000/0000
		-fg rgba:$fc/$fc/$fc/ffff
		-fn "xft:Noto Sans Mono:$fn:pixelsize=32"
		-bl
		-title OSD-$fc
		-xrm "urxvt*internalBorder: 0"
		-xrm "urxvt*scrollBar: false"
		-xrm "urxvt*scrollBar_right: false"
	);
	
	[ $fc = 0000 ] &&
		for n in {1..16}; do
			args+=(-xrm "*color$n: #000000");
		done;
	
	urxvt "${args[@]}" -e tmux -2u a -t osd-0 &
done;
sleep 1;
./osd-ctl.sh
