samedir tweak

This commit is contained in:
Luke Smith 2020-03-08 18:23:38 -04:00
parent b085acedb0
commit 2acedd3517
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
# Open a terminal window in the same directory as the currently active window.
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g') PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
cd "$(readlink /proc/"$PID"/cwd)" cd "$(readlink /proc/"$PID"/cwd)" || return 1
"$TERMINAL" "$TERMINAL"