os/pkgs/wcwd.nix
2023-11-10 19:48:06 +01:00

7 lines
255 B
Nix

self:
with self; ''
pid=$(${sway}/bin/swaymsg -t get_tree | ${jq}/bin/jq '.. | select(.type?) | select(.type=="con") | select(.focused==true).pid')
ppid=$(${procps}/bin/pgrep --newest --parent ''${pid})
readlink /proc/''${ppid}/cwd || echo $HOME
''