diff options
Diffstat (limited to 'scripts/.local/bin/samedir')
| -rwxr-xr-x | scripts/.local/bin/samedir | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/.local/bin/samedir b/scripts/.local/bin/samedir new file mode 100755 index 0000000..73facfd --- /dev/null +++ b/scripts/.local/bin/samedir @@ -0,0 +1,8 @@ +#!/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="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')" +cd "$(readlink /proc/"$PID"/cwd)" || return 1 +"$TERMINAL" |
