samedir (282B)
1 #!/usr/bin/env sh 2 PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) 3 PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') 4 cd "$(readlink /proc/"$PID"/cwd)" 5 "$TERMINAL"