2020-02-08 23:43:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-03-08 22:23:38 +00:00
|
|
|
# Open a terminal window in the same directory as the currently active window.
|
|
|
|
|
2018-12-09 20:26:40 +00:00
|
|
|
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
|
2020-03-08 22:23:38 +00:00
|
|
|
PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
|
|
|
|
cd "$(readlink /proc/"$PID"/cwd)" || return 1
|
2018-12-09 20:26:40 +00:00
|
|
|
"$TERMINAL"
|