Repository navigation
Open
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
This was originally reported at discussions/26745, where the reproduction method was more complex. However, I have confirmed that the undermentioned is sufficient, which Metekillot (@Metekillot) corroborates:
#!/usr/bin/env pwsh
#Requires -PSEdition Core
#Requires -Version 7.5.4
If ($Env:XDG_CURRENT_DESKTOP -Eq 'KDE') {
wl-copy 'Placeholder' && `
wl-paste && `
Get-Clipboard
}You should not utilise Start-Transcript to record this, as issues/26833 explains.
Expected behavior
PS /> wl-copy 'Placeholder'
PS /> wl-paste
Placeholder
PS /> Get-Clipboard
Placeholder
PS />Actual behavior
PS /> wl-copy 'Placeholder' PS /> wl-paste Placeholder PS /> Get-Clipboard PS />
Error details
PS /> $(Get-Error -Newest 1) -Eq $Null True
Environment data
PSVersion : 7.5.4
PSEdition : Core
GitCommitId : 7.5.4
OS : Fedora Linux 43 (KDE Plasma Desktop Edition)
Platform : Unix
PSCompatibleVersions : {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion : 2.3
SerializationVersion : 1.1.0.1
WSManStackVersion : 3.0Visuals

Reacted by Mr Beedell, Roke Julian Lockhart, Metekillot and AnotherLuckyGuy
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation
Type
Projects
- StatusShow more project fieldsReviewed
Activity
237dmitry commentedon Feb 15, 2026
I wonder what utility the *-Clipboard cmdlets use? The help says it's xclip, but why do them work on a TTY (without X11)? And what should be used on Wayland?
beedell-roke commentedon Feb 15, 2026
237dmitry,
blob/08b13f24e6d359877b2cdbe650f7c8fc5ca20135/src/Microsoft.PowerShell.Commands.Management/commands/management/GetClipboardCommand.csdefines it:PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/GetClipboardCommand.cs
Lines 1 to 116 in 08b13f2
However, I do not know where
GetTextis defined, nor whyPlatformNotSupportedExceptionis not raised, at the least.mklement0 commentedon Feb 15, 2026
PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/Clipboard.cs
Line 62 in 08b13f2
xclipis used on Linux, andpbpasteon macOS.[-]7.5.4 cannot read the clipboard.[/-][+]7.5.4 cannot read the clipboard on Wayland.[/+]beedell-roke commentedon Feb 15, 2026
Michael Klement (@mklement0),
Get-Command xclipraises:Consequently, why does calling
Get-Clipboardnot raise an error? My$ErrorActionPreferenceis notSilentlyContinue. It'sContinue.mklement0 commentedon Feb 15, 2026
If
xclipisn't available, PowerShell falls back to an internal, PowerShell-only clipboard.That is, with
xclipnot found to be installed on a Linux distro,Set-Clipboard foo && Get-Clipboardworks, but only becauseSet-Clipboardwas the command to fill the PowerShell-only clipboard.Conversely, any clipboard provided by any other external utility will not be seen by
Get-Clipboard.beedell-roke commentedon Feb 15, 2026
Michael Klement (@mklement0), might I create a separate FR to modify that behaviour? I don't see a use case for it, without, at the least, informing the user that the system clipboard is unavailable.
mklement0 commentedon Feb 15, 2026
The use case is that as long as it is
Set-Clipboardthat's filling the clipboard,Get-Clipboardwill work as expected.That said: Yes, it's worth creating a feature request.
My hunch is that, in the interest of maintaining backward compatibility, the most realistic solution is to require
-Verbosein order to be informed of the unavailability of PowerShell-transcendent functionality.beedell-roke commentedon Feb 16, 2026
brianary commentedon Mar 21, 2026
GNOME 50 is out and removes X11 entirely in favor of Wayland, which is going to affect most linux distributions soon, so a Wayland fallback is pretty important. In fact, we're moving toward a situation where Wayland should probably be the primary clipboard with a fallback to X11.
GNOME 50 debuts with X11 axed, Wayland front and center • The Register
CommanderTurtle commentedon Oct 20, 2026
xclip is annoying - still unfixed, unclosed PR. 'pwsh' as a linux shell hardcodes 'xclip'.
wl-copy is needed
Solution? Save as
~/tmp/xclip-wayland-shim.shxclip-wayland-shim.sh
Then run:
bash ./xclip-wayland-shim.sh & source ~/.bashrcSet-Clipboardis otherwise a dead, non-erroring cmdlet.This fixes so stdin & out work under xclip without using anything but a fancy shim.
Other solution, i.e. Practical options on Wayland:
Get-Content file | wl-copy/wl-paste.$DISPLAYset),pacman -S xclipmakes the cmdlets work.xclipwith a shim earlier on your PATH that translates to wl-clipboard on Wayland:That covers exactly the two call patterns pwsh uses (
-selection clipboard -in/-out), and both read/write stdin/stdout just like wl-copy/wl-paste do.So the read is correct: as of 7.6.6,
Set-Clipboardon a Wayland-only system is functionally dead — it's an xclip-only implementation with a silent in-memory fallback, and Wayland support is still an open gap upstream.picture of working shim
brianary commentedon Oct 21, 2026
KDE has now followed GNOME in switching to Wayland. This will soon represent the vast majority of linux systems.
KDE turns 30 with Plasma 6.8, remote upgrades, and an X11 farewell - Ars Technica
1 remaining item
[-]7.5.4 cannot read the clipboard on Wayland.[/-][+]The system clipboard silently fails to be read, via all Wayland compositors.[/+]SteveL-MSFT commentedon Nov 4, 2026
The @PowerShell/wg-powershell-cmdlets discussed this. We agree that for Linux, the clipboard cmdlets should use the Wayland tools if xclip is not available.
beedell-roke commentedon Nov 4, 2026
Steve Lee (@SteveL-MSFT), would XClip function with a non-X{Org} compositor, even if it were in
$Env:PATH?CommanderTurtle commentedon Nov 4, 2026
If the shim is performed like above 😂
Details
beedell-roke commentedon Nov 4, 2026
CommanderTurtle, yes; that's an abstraction above XClip. That's what I desire. However, what I quoted indicated that an implementation to solve this may merely check for the existence of XClip installed, rather than consider XClip's compatibility with its environment.
BTW, best to paste text as actual text, rather than a screenshot, when feasible. Consider anyone who utilises a screen reader; OCR tools shall struggle with that.
CommanderTurtle commentedon Nov 4, 2026
For sure. The reply above had a full code reply inlined. Might've been overthinking it. I was just restating in case it was a simple check to see if xclip responds, since it would be much more robust to rather check for the package through the applicable package manager:
pacman -Q xclip, etc. In this case though, just wanted to mention all of omarchy faces this trouble with powershell (Powershell effectively has no clipboard for all omarchy users - unless they run a shim workaround and stumbled on these very issue discussion threads).off-topic
I don't see anyone using the internet from cli nowadays, but, your advice makes sense.
The information contained within the image is in text above though in the codeblock, so, no info lost at least.
WebAssembly build of paddle-ocr for console screen readers, if you're stumbling on this in the future from terminal emulator --> ppocr-wasm
beedell-roke commentedon Nov 4, 2026
CommanderTurtle, hence the previous reference to
$Env:PATH;Get-Commandprovides that.That is true for all Wayland DEs, to the same degree. No PowerShell clipboard exists for any Wayland DE.
CommanderTurtle commentedon Nov 5, 2026
Turns out I was wrong. A package manager check isn't enough. Lol. Omarchy's hyprland shows xclip but only wl-clip is the proved working path. After shim, xclip still responds to package manager call.
Makes this even more convoluted to shim installers.
PowerShell has no idea what your compositor is. It's all env vars and
loginctl...Proper method is probably then a test just simply if "Set-Clipboard" modifies the clipboard. If both are installed fallover to wl-clipboard - due to xwayland being wonky to begin with.
This is the whole reason to care which binary is real. On omarchy,
xcliponly works via XWayland — and it hangs forever if no X socket exists, which is a miserable failure mode in a script.And to sanity-check that the winner on PATH actually functions rather than merely existing:
If
~/.local/bin/xclipturns out to be a shim thatexecswl-clipboard(a common trick people use to makexclipscripts work on Wayland), that explains everything — and you'd want to keep it, not "fix" it by putting/usr/binfirst.Second command apparently hangs... which I guess, is a good thing! Science succeeded.
beedell-roke commentedon Nov 5, 2026
CommanderTurtle, that's probably worth a PR for
astrand/xclip, citing this andissues/62#issuecomment-966020595as examples of interest in it.