inconsequential efficiency
This commit is contained in:
parent
e9b40ba554
commit
18dad565fa
1 changed files with 4 additions and 2 deletions
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
# Open a terminal window in the same directory as the currently active window.
|
# 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 | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
|
||||||
PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
|
PID="$(pstree -lpA "$PID")"
|
||||||
|
PID="${PID##*(}"
|
||||||
|
PID="${PID%)}"
|
||||||
cd "$(readlink /proc/"$PID"/cwd)" || return 1
|
cd "$(readlink /proc/"$PID"/cwd)" || return 1
|
||||||
"$TERMINAL"
|
"$TERMINAL"
|
||||||
|
|
Loading…
Reference in a new issue