Fix sd script not working on firefox

This commit is contained in:
Rokosun 2022-11-16 12:42:21 +00:00 committed by GitHub
parent 78b248c898
commit eecaf9eb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,5 +5,5 @@
PID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
PID=$(pstree -lpATna "$PID" | grep -v '\-\(lf,[0-9]\+ -server\|(st-urlhandler,[0-9]\+)\|xclip,[0-9]\+\)' | sed '$s/.*,\([0-9]\+\).*/\1/;t;d')
cwd=$(readlink /proc/"$PID"/cwd)
[ "$PWD" = "$cwd" ] || cd "$cwd" || exit 1
[ "$PWD" != "$cwd" ] && [ -d "$cwd" ] && { cd "$cwd" || exit 1; }
"$TERMINAL"