#!/usr/bin/env sh
# wallstreet widget: table of the most active stocks and the biggest movers, selectable
#
# Part of wallstreet.  Copyright 2014-2026 Dustin Kirkland
# <dustin.kirkland@gmail.com>, macOS port and data sources 2026.
# Licensed under the Apache License, Version 2.0; see LICENSE.

PKG=wallstreet
WSDATA="$(dirname "$0")/../../share/$PKG/wsdata"
# Ctrl-C in any pane ends the show: close the window all widgets live in
quit() {
	[ -n "$TMUX_PANE" ] && tmux kill-window -t "$TMUX_PANE" >/dev/null 2>&1
	exit 0
}
trap quit INT QUIT TERM

# Interactive: click a row or move with the arrow keys, the chart pane follows.
# wsdata redraws by itself every minute and when the pane changes its size.
while true; do
	"$WSDATA" browse || sleep 2
done
