extrawurst / gitui

Blazing 💥 fast terminal-ui for git written in rust 🦀
MIT License
18.64k stars 573 forks source link

Support "Copy Path" operation in WSL #2413

Closed johnDeSilencio closed 3 weeks ago

johnDeSilencio commented 3 weeks ago

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:

gitui

extrawurst commented 3 weeks ago

@cruessler could you test that on windows?

cruessler commented 3 weeks ago

@cruessler could you test that on windows?

I only have Linux and Mac machines available, unfortunately.

Concelare commented 3 weeks ago

I can test it tonight if you want @extrawurst

extrawurst commented 3 weeks ago

@Concelare that would be awesome

johnDeSilencio commented 3 weeks ago

@extrawurst Sorry! Meant to mention that I was going to test it when I got back into work today and had access to my WSL instance. Looks like everything is working as expected! :)

gitui_wsl

Concelare commented 3 weeks ago

I tested this and it worked as expected,I didn't have the most time this evening to test it in every way but I had no issues using it as intended. 👍

Tested on Windows 10 WSL 2 Ubuntu 24.04, Used it on few different git repos of different size with no issues

johnDeSilencio commented 3 weeks ago

I tested this and it worked as expected,I didn't have the most time this evening to test it in every way but I had no issues using it as intended. 👍

Tested on Windows 10 WSL 2 Ubuntu 24.04, Used it on few different git repos of different size with no issues

Thank you, @Concelare!

extrawurst commented 3 weeks ago

@johnDeSilencio thank you for the contribution!