Make Sway start the daemon
This commit is contained in:
parent
330484eba1
commit
3b4477490d
2 changed files with 24 additions and 22 deletions
34
run-dev
34
run-dev
|
|
@ -13,6 +13,9 @@ mkdir -p "$DATA_DIR"
|
||||||
export SHEPHERD_SOCKET="$SOCKET_PATH"
|
export SHEPHERD_SOCKET="$SOCKET_PATH"
|
||||||
export SHEPHERD_DATA_DIR="$DATA_DIR"
|
export SHEPHERD_DATA_DIR="$DATA_DIR"
|
||||||
|
|
||||||
|
# Note: Since shepherdd now runs inside sway, spawned apps automatically
|
||||||
|
# use the nested compositor's display. No SHEPHERD_WAYLAND_DISPLAY override needed.
|
||||||
|
|
||||||
# Build all binaries
|
# Build all binaries
|
||||||
echo "Building shepherd binaries..."
|
echo "Building shepherd binaries..."
|
||||||
cargo build
|
cargo build
|
||||||
|
|
@ -20,28 +23,21 @@ cargo build
|
||||||
# Function to cleanup background processes on exit
|
# Function to cleanup background processes on exit
|
||||||
cleanup() {
|
cleanup() {
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
if [ ! -z "$SHEPHERDD_PID" ]; then
|
# Kill the nested sway - this will clean up everything inside it (including shepherdd)
|
||||||
kill $SHEPHERDD_PID 2>/dev/null || true
|
if [ ! -z "$SWAY_PID" ]; then
|
||||||
fi
|
kill $SWAY_PID 2>/dev/null || true
|
||||||
if [ ! -z "$HUD_PID" ]; then
|
|
||||||
kill $HUD_PID 2>/dev/null || true
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
# Start the background daemon
|
# Note: shepherdd is started by sway.conf so it runs INSIDE the nested compositor.
|
||||||
echo "Starting shepherdd..."
|
# This ensures all spawned processes (games, apps) use the nested compositor's display.
|
||||||
./target/debug/shepherdd -c ./config.example.toml &
|
|
||||||
SHEPHERDD_PID=$!
|
|
||||||
|
|
||||||
# Give the daemon a moment to initialize
|
# Start sway with the launcher and HUD
|
||||||
sleep 1
|
# The HUD and launcher are started by sway.conf so they run INSIDE the nested compositor
|
||||||
|
echo "Starting nested sway with shepherd-launcher..."
|
||||||
|
WLR_BACKENDS=wayland WLR_LIBINPUT_NO_DEVICES=1 sway -c ./sway.conf &
|
||||||
|
SWAY_PID=$!
|
||||||
|
|
||||||
# Start the HUD in the background
|
# Wait for sway to exit
|
||||||
echo "Starting shepherd-hud..."
|
wait $SWAY_PID
|
||||||
./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
|
|
||||||
|
|
|
||||||
12
sway.conf
12
sway.conf
|
|
@ -100,11 +100,17 @@ workspace 1 output *
|
||||||
|
|
||||||
### Application startup
|
### Application startup
|
||||||
|
|
||||||
# Note: shepherdd (daemon) and shepherd-hud are started by run-dev script
|
# Start the daemon FIRST - it needs to create the socket before HUD/launcher connect
|
||||||
# before sway launches, so they're already running at this point
|
# Running inside sway ensures all spawned processes use the nested compositor
|
||||||
|
exec ./target/debug/shepherdd -c ./config.example.toml
|
||||||
|
|
||||||
|
# Give the daemon a moment to initialize, then start UI components
|
||||||
|
# Start the shepherd-hud (time remaining overlay)
|
||||||
|
exec sleep 1 && $hud
|
||||||
|
|
||||||
# Start the shepherd-launcher on startup (the main "home" screen)
|
# Start the shepherd-launcher on startup (the main "home" screen)
|
||||||
exec_always $launcher
|
# Small delay to ensure daemon is ready
|
||||||
|
exec_always sleep 1 && $launcher
|
||||||
|
|
||||||
### Disable workspace switching
|
### Disable workspace switching
|
||||||
# No keybindings defined = no switching possible
|
# No keybindings defined = no switching possible
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue