Support "Copy Path" operation in WSL by johnDeSilencio · Pull Request #2413 · gitui-org/gitui

This PR adds support for the "Copy Path" operation in the "Files" tab when running in WSL.

For those like myself who are accessing WSL from a terminal, there is no X server, so xclip won't work. However, my Ubuntu WSL image at work still has xclip installed, which gitui detects and uses, causing gitui to freeze. I have to kill gitui at that point.

This PR checks if we are running in WSL by examining the description of the kernel in the OS release file, /proc/sys/kernel/osrelease. If gitui is running in WSL, we copy the path to the Windows clipboard using the clip.exe utility.

I followed the checklist:

  • I added unittests (I didn't see any other unit tests in clipboard.rs, so I didn't try to add any here)
  • I ran make check without errors (proof: output.txt)
  • I tested the overall application (see below)
  • I added an appropriate item to the changelog (put in the Added subsection under Unreleased)

gitui