From f03efe97d9d01407691a940d8d6703ab82547bc6 Mon Sep 17 00:00:00 2001 From: Rokosun <79040025+futureisfoss@users.noreply.github.com> Date: Fri, 24 Jun 2022 03:35:02 +0000 Subject: [PATCH] fix bug in samedir script (#1127) samedir didn't work properly when the shell was opened inside lf using the w keybinding, now its fixed. --- .local/bin/samedir | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/samedir b/.local/bin/samedir index 0a19707..371ec64 100755 --- a/.local/bin/samedir +++ b/.local/bin/samedir @@ -4,7 +4,7 @@ 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%)}" +PID="${PID##*"${SHELL##*/}"(}" +PID="${PID%%)*}" cd "$(readlink /proc/"$PID"/cwd)" || return 1 "$TERMINAL"