Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions motd.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
# squarebox MOTD — orange metallic banner with SDK info

# Herdr creates a fresh interactive shell for every managed pane and exports
# HERDR_ENV=1 there. The outer Box shell has already shown the MOTD, so avoid
# repeating the full banner in every Herdr tab and split.
[ "${HERDR_ENV:-}" = 1 ] && exit 0

# Orange metallic: bright orange heading, muted orange date
printf '\e[1;38;5;208m'
toilet -f smblock --metal "squarebox"
Expand Down
27 changes: 27 additions & 0 deletions tests/test-motd-startup-policy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT

mkdir -p "$TMP/bin"
cat > "$TMP/bin/toilet" <<'EOF'
#!/usr/bin/env bash
printf 'squarebox\n'
EOF
chmod +x "$TMP/bin/toilet"

normal_output=$(HERDR_ENV=0 PATH="$TMP/bin:$PATH" bash "$ROOT/motd.sh")
if [[ "$normal_output" != *squarebox* ]]; then
echo "FAIL: MOTD should render outside Herdr" >&2
exit 1
fi

herdr_output=$(HERDR_ENV=1 PATH="$TMP/bin:$PATH" bash "$ROOT/motd.sh")
if [ -n "$herdr_output" ]; then
echo "FAIL: MOTD should be silent in a Herdr-managed pane" >&2
exit 1
fi

echo "PASS: MOTD renders normally and stays silent inside Herdr"