# alias wezterm='flatpak run org.wezfurlong.wezterm'

flatpak run org.wezfurlong.wezterm cli set-window-title "syncopotamus"

flatpak run org.wezfurlong.wezterm cli set-tab-title "Go"
echo "cd ~/repos/syncopotamus-go" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste
echo "export SYNCOPOTAMUS_BC_CLIENT_ID='de4602c11dcdacfbe8f1a172f84b4e88b7a1adeb'" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste
echo "export SYNCOPOTAMUS_BC_CLIENT_SECRET='710ddd0ec04c098adca8564e4caab2c7034ad272'" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste
echo "export SYNCOPOTAMUS_BC_REDIRECT_SERVER='http://localhost'" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste
echo "clear" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste
echo "go run ." | flatpak run org.wezfurlong.wezterm cli send-text --no-paste

pane=$(flatpak run org.wezfurlong.wezterm cli split-pane --left)
echo "cd ~/repos/syncopotamus-go" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste --pane-id $pane
echo "nvim" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste --pane-id $pane
flatpak run org.wezfurlong.wezterm cli adjust-pane-size --amount 50 --pane-id $pane right

pane=$(flatpak run org.wezfurlong.wezterm cli spawn --pane-id $pane)
flatpak run org.wezfurlong.wezterm cli set-tab-title --pane-id $pane "Svelte"
echo "cd ~/repos/syncopotamus-svelte" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste --pane-id $pane
echo "npm run dev" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste --pane-id $pane

pane=$(flatpak run org.wezfurlong.wezterm cli split-pane --left --pane-id $pane)
echo "cd ~/repos/syncopotamus-svelte" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste --pane-id $pane
echo "nvim" | flatpak run org.wezfurlong.wezterm cli send-text --no-paste --pane-id $pane
flatpak run org.wezfurlong.wezterm cli adjust-pane-size --amount 50 --pane-id $pane right

if [ "$1" == "web" ]; then
  firefox https://3.basecamp.com/5456546/buckets/34127086/card_tables/6496384013 &
  firefox --new-window http://localhost:5173/user/noisycarlos/dashboard &
fi
