laktak / extrakto

extrakto for tmux - quickly select, copy/insert/complete text without a mouse
MIT License
878 stars 45 forks source link

Added full path for clip.exe for WSL (#125) #126

Closed rpop0 closed 1 month ago

rpop0 commented 1 month ago

As explained in issue #125 if appendWindowsPath is disabled in /etc/wsl.conf, using the clip.exe executable directly is not possible. Switching to the full path fixes this and should work in all situations, regardless of appendWindowsPath.

laktak commented 1 month ago

Thanks for your PR but can you provide a solution that does not hard code the path? I'm not 100% sure this will not break someone's setup.

I don't have a WSL running right now but I think there is a environment variable that points to windows/system32. Can you check and use that instead?

rpop0 commented 1 month ago

Sure, I'll look into it if there is any way to determine this path automatically, but I don't think having it hard coded is an issue.

As far as I am aware, the Windows drive is always mapped to C:\ and it seems like that's always mounted under "/mnt/c" in WSL (https://learn.microsoft.com/en-us/windows/wsl/filesystems)

laktak commented 1 month ago

I didn't see any env variable but you could check if clip.exe is in the system path and only try the hardcoded path if this fails.

shutil.which("clip.exe") is not None
laktak commented 1 month ago

Looks good (I'll fix the formatting). Thanks!