The script uses the recently added _NET_WM_PID window property for finding the program running in Alacritty, fetching its working directory, and spawning a new Alacritty using that directory.