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.
|
|
|
|
|
2021-10-20 14:50:13 +00:00
|
|
|
PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
|
|
|
|
PID="$(pstree -lpA "$PID")"
|
2022-06-24 03:35:02 +00:00
|
|
|
PID="${PID##*"${SHELL##*/}"(}"
|
2022-10-15 01:25:19 +00:00
|
|
|
PID="${PID#*lf(}"
|
2022-06-24 03:35:02 +00:00
|
|
|
PID="${PID%%)*}"
|
2020-03-08 22:23:38 +00:00
|
|
|
cd "$(readlink /proc/"$PID"/cwd)" || return 1
|
2018-12-09 20:26:40 +00:00
|
|
|
"$TERMINAL"
|