mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
17 lines
419 B
Bash
Executable File
17 lines
419 B
Bash
Executable File
#!/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)
|
|
|
|
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"
|
|
else
|
|
echo "$HOME"
|
|
fi
|
|
else
|
|
echo "$HOME"
|
|
fi
|