Skip to content

Commit db71a65

Browse files
authored
add clipboard support for wayland on Linux (#41376)
1 parent be08627 commit db71a65

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stdlib/InteractiveUtils/src/clipboard.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,27 @@ elseif Sys.islinux() || Sys.KERNEL === :FreeBSD
3737
`xsel --input --clipboard` :
3838
`xsel -c`,
3939
:xclip => `xclip -silent -in -selection clipboard`,
40+
:wlclipboard => `wl-copy`
4041
)
4142
const _clipboard_paste = Dict(
4243
:xsel => Sys.islinux() ?
4344
`xsel --nodetach --output --clipboard` :
4445
`xsel -p`,
4546
:xclip => `xclip -quiet -out -selection clipboard`,
47+
:wlclipboard => `wl-paste`
4648
)
4749
function clipboardcmd()
4850
global _clipboardcmd
4951
_clipboardcmd !== nothing && return _clipboardcmd
50-
for cmd in (:xclip, :xsel)
51-
success(pipeline(`which $cmd`, devnull)) && return _clipboardcmd = cmd
52+
for cmd in (:xclip, :xsel, :wlclipboard)
53+
# wl-clipboard ships wl-copy/paste individually
54+
c = cmd == :wlclipboard ? Symbol("wl-copy") : cmd
55+
success(pipeline(`which $c`, devnull)) && return _clipboardcmd = cmd
5256
end
5357
pkgs = @static if Sys.KERNEL === :FreeBSD
5458
"x11/xsel or x11/xclip"
5559
else
56-
"xsel or xclip"
60+
"xsel or xclip or wl-clipboard"
5761
end
5862
error("no clipboard command found, please install $pkgs")
5963
end

0 commit comments

Comments
 (0)