diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2021-10-20 10:32:46 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2021-10-20 10:32:46 -0400 |
| commit | cb7879cd7ecc7d226bcb3f00c6cc0e343f03bff7 (patch) | |
| tree | 3c654798ddc4983594693f211cb575cb29f8ad67 /.local | |
| parent | 7928c52e90d6c5facde5e78967321e4a492812fb (diff) | |
| download | eibhear-cb7879cd7ecc7d226bcb3f00c6cc0e343f03bff7.tar.gz eibhear-cb7879cd7ecc7d226bcb3f00c6cc0e343f03bff7.tar.zst eibhear-cb7879cd7ecc7d226bcb3f00c6cc0e343f03bff7.zip | |
unbreak samedir
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/samedir | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/.local/bin/samedir b/.local/bin/samedir index 82397d3..73facfd 100755 --- a/.local/bin/samedir +++ b/.local/bin/samedir @@ -2,4 +2,7 @@ # Open a terminal window in the same directory as the currently active window. -setsid -f $TERMINAL >/dev/null 2>&1 +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" |
