#!/bin/bash
pid="$(xdotool getactivewindow getwindowpid)"
[ -n "$pid" ] && cd "$(readlink -f "/proc/$(pgrep -P "$pid")/cwd")" &>/dev/null || cd "$HOME"
exec st "${SHELL:-bash}"