diff options
| author | --global <ik.boikov.public@protonmail.com> | 2021-07-14 23:02:24 +0200 |
|---|---|---|
| committer | --global <ik.boikov.public@protonmail.com> | 2021-07-14 23:02:24 +0200 |
| commit | fd850fb2ed9870edcb1df205e08e8ccb25fb6760 (patch) | |
| tree | 641b5af724d86a0a383b2c580dd838b03c1cc42c /scripts/.local/bin/samedir | |
| parent | 72000d2f0c23a685f4c4d458158712340f6b9a68 (diff) | |
more nnn plugins, more luke's scripts
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" |
