Cleanup the code a bit

This commit is contained in:
David Heinemeier Hansson
2025-10-07 15:37:29 +02:00
parent f956233ecf
commit e9ab1d9bcc

View File

@@ -5,9 +5,10 @@ terminal_pid=$(hyprctl activewindow | awk '/pid:/ {print $2}')
shell_pid=$(pgrep -P "$terminal_pid" | head -n1)
if [[ -n $shell_pid ]]; then
found_cwd=$(readlink -f "/proc/$shell_pid/cwd" 2>/dev/null || echo "$HOME")
if [[ -d "$found_cwd" ]]; then
echo "$found_cwd"
cwd=$(readlink -f "/proc/$shell_pid/cwd" 2>/dev/null)
if [[ -d $cwd ]]; then
echo "$cwd"
else
echo "$HOME"
fi