Make sd script work with lf file manager too (#1212)

Now sd script can open a terminal window in the same directory as the currently active lf file manager window
This commit is contained in:
Rokosun 2022-10-15 01:25:19 +00:00 committed by GitHub
parent 44d740bd44
commit cc7ac4619a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@
PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
PID="$(pstree -lpA "$PID")" PID="$(pstree -lpA "$PID")"
PID="${PID##*"${SHELL##*/}"(}" PID="${PID##*"${SHELL##*/}"(}"
PID="${PID#*lf(}"
PID="${PID%%)*}" PID="${PID%%)*}"
cd "$(readlink /proc/"$PID"/cwd)" || return 1 cd "$(readlink /proc/"$PID"/cwd)" || return 1
"$TERMINAL" "$TERMINAL"