diff --git a/.local/bin/samedir b/.local/bin/samedir index 0a19707..371ec64 100755 --- a/.local/bin/samedir +++ b/.local/bin/samedir @@ -4,7 +4,7 @@ PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") PID="$(pstree -lpA "$PID")" -PID="${PID##*(}" -PID="${PID%)}" +PID="${PID##*"${SHELL##*/}"(}" +PID="${PID%%)*}" cd "$(readlink /proc/"$PID"/cwd)" || return 1 "$TERMINAL"