shepherd-launcher/run-dev
2025-12-27 10:50:54 -05:00

47 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
# Set up dev runtime directory
DEV_RUNTIME="./dev-runtime"
DATA_DIR="$DEV_RUNTIME/data"
SOCKET_PATH="$DEV_RUNTIME/shepherd.sock"
mkdir -p "$DATA_DIR"
# Export environment variables for shepherd binaries
export SHEPHERD_SOCKET="$SOCKET_PATH"
export SHEPHERD_DATA_DIR="$DATA_DIR"
# Build all binaries
echo "Building shepherd binaries..."
cargo build
# Function to cleanup background processes on exit
cleanup() {
echo "Cleaning up..."
if [ ! -z "$SHEPHERDD_PID" ]; then
kill $SHEPHERDD_PID 2>/dev/null || true
fi
if [ ! -z "$HUD_PID" ]; then
kill $HUD_PID 2>/dev/null || true
fi
}
trap cleanup EXIT
# Start the background daemon
echo "Starting shepherdd..."
./target/debug/shepherdd -c ./config.example.toml &
SHEPHERDD_PID=$!
# Give the daemon a moment to initialize
sleep 1
# Start the HUD in the background
echo "Starting shepherd-hud..."
./target/debug/shepherd-hud &
HUD_PID=$!
# Start sway with the launcher
echo "Starting sway with shepherd-launcher..."
WLR_BACKENDS=wayland WLR_LIBINPUT_NO_DEVICES=1 sway -c ./sway.conf