You'd roughly need to:
- Figure out which program is currently focused
- Figure out the Git repo of this software
- Clone it into a temporary directory
- Set up the required tools to start hacking on it and compile it
As a quick prototype, I wrote a li'l Bash script that does some of these things. It makes heavy use of #nix and #nixpkgs:
https://codeberg.org/blinry/view-source-button
I enters a "dev shell" with the required tools already in the PATH, and even sets up a Git remote to start contributing. :D