#!/bin/bash

CHILD_PID=$(pgrep -P $1)

pushd "/proc/$CHILD_PID/cwd"
SHELL_CWD=$(pwd -P)
popd

# Start alacritty with the working directory
alacritty --working-directory "$SHELL_CWD"