diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2021-10-20 10:50:13 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2021-10-20 10:50:13 -0400 |
| commit | 18dad565fa03801f12bc010324e578d32a4883e0 (patch) | |
| tree | 9402e3955ecb4bf6d52b6b7b60174857d36d6037 /.local/bin | |
| parent | e9b40ba5546459bbe14176299052abcd4ce4d0ba (diff) | |
| download | eibhear-18dad565fa03801f12bc010324e578d32a4883e0.tar.gz eibhear-18dad565fa03801f12bc010324e578d32a4883e0.tar.zst eibhear-18dad565fa03801f12bc010324e578d32a4883e0.zip | |
inconsequential efficiency
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/samedir | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/.local/bin/samedir b/.local/bin/samedir index 73facfd..0a19707 100755 --- a/.local/bin/samedir +++ b/.local/bin/samedir @@ -2,7 +2,9 @@ # 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')" +PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") +PID="$(pstree -lpA "$PID")" +PID="${PID##*(}" +PID="${PID%)}" cd "$(readlink /proc/"$PID"/cwd)" || return 1 "$TERMINAL" |
