#!/bin/bash # Go from current active terminal to its child shell process and run cwd there terminal_pid=$(hyprctl activewindow | awk '/pid:/ {print $2}') shell_pid=$(pgrep -P "$terminal_pid" | head -n1) readlink -f "/proc/$shell_pid/cwd" 2>/dev/null || echo "$HOME"