Skip to content

Commit

Permalink
Added full path for clip.exe for WSL (#125) (#126)
Browse files Browse the repository at this point in the history
* Added full path for clip.exe for WSL (#125)

* Made the WSL clip path a fallback

Getting the clipboard for WSL will check if clip.exe exists before just using the full path as a fallback.
  • Loading branch information
rpop0 authored Aug 25, 2024
1 parent b297d45 commit 83ac347
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extrakto_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import platform
import re
import subprocess
import shutil
import sys
import traceback

Expand Down Expand Up @@ -137,7 +138,7 @@ def __init__(self, trigger_pane, launch_mode):
if re.search(
r"Microsoft|microsoft", open("/proc/sys/kernel/osrelease").read()
):
self.clip_tool = "clip.exe"
self.clip_tool = ExtraktoPlugin._get_wsl_clip_executable()
elif os.environ.get("XDG_SESSION_TYPE", None) == "wayland":
self.clip_tool = "wl-copy"
else:
Expand Down Expand Up @@ -413,6 +414,12 @@ def capture(self):
self.copy(PRJ_URL)
else:
return 0
@staticmethod
def _get_wsl_clip_executable():
if shutil.which('clip.exe') is None:
return '/mnt/c/Windows/System32/clip.exe'
return 'clip.exe'



if __name__ == "__main__":
Expand Down

0 comments on commit 83ac347

Please sign in to comment.