mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-06 04:20:23 +00:00
18 lines
384 B
Bash
Executable File
18 lines
384 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" | tail -n1)
|
|
|
|
if [[ -n $shell_pid ]]; then
|
|
cwd=$(readlink -f "/proc/$shell_pid/cwd" 2>/dev/null)
|
|
|
|
if [[ -d $cwd ]]; then
|
|
echo "$cwd"
|
|
else
|
|
echo "$HOME"
|
|
fi
|
|
else
|
|
echo "$HOME"
|
|
fi
|