pub-solar-os/pkgs/wcwd.nix
2022-11-20 23:28:23 +01:00

7 lines
231 B
Nix

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