Skip to content

Commit

Permalink
Enable Windows clipboard in WSL #1920
Browse files Browse the repository at this point in the history
  • Loading branch information
daviewales committed Feb 8, 2025
1 parent 8f8aaec commit 6e777d1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions visidata/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
import functools
import os
import itertools
import platform

from visidata import VisiData, vd, asyncthread, SettableColumn
from visidata import Sheet, Path, Column

if sys.platform == 'win32':
if (
# Windows
sys.platform == 'win32'
# WSL 2
or "microsoft-standard-WSL2" in platform.uname().release
# WSL 1
or sys.platform == 'linux' and platform.uname().release.endswith("-Microsoft")
):
syscopy_cmd_default = 'clip.exe'
syspaste_cmd_default = 'powershell -command Get-Clipboard'
syspaste_cmd_default = 'powershell.exe -noprofile -command Get-Clipboard'
elif sys.platform == 'darwin':
syscopy_cmd_default = 'pbcopy w'
syspaste_cmd_default = 'pbpaste'
Expand Down

0 comments on commit 6e777d1

Please sign in to comment.