Closed dasistkeintest closed 1 year ago
Same issue with 2.35 (using the release binary) between a Windows 10 laptop and a MacBook Air M1 running Ventura 13.1. Initiation works (the two "sees" each other). Debug shows the clipboard contents are sent (both ways) but not received.
The issue is a bit different with --secure
option.
With this option, cilpboard content is received (Mac -> PC) but the clipboard on PC is immediately emptied and an empty content is sent back to the Mac (but not received by it). When trying from PC to Mac, the PC sends the content, the Mac receives it an keeps it (so it works). The Mac sends the content back immediately to the PC and this create the same issue than Mac -> PC (PC receives but empties the clipboard immediately).
These tests were done with the server started on the Mac. The results are the same (PC receives the content but empties it immediately) with the server started on PC.
That's very strange, I will try to reproduce it.
I'll try to do some additional testing with another laptop running Win7.
The problem is coming from the setLocalClip()
function on Windows.
The variable "s" is no longer being used to set the clipboard, which is causing an empty string to be forced into the clipboard.
there is no -Value
in the powershell command and no pipe executed for windows.
I have gone back to the previous code:
copyCmd = exec.Command("powershell.exe", "-command", "Set-Clipboard -Value "+"\""+s+"\"")
I have only debugged the version with --secure, the version without encryption does not seem to work with this fix.
To make it work without the --secure
flag, the clipboardBytes
variable in the sendClipboard()
function must be filled with the data that we want to send. However, this is not the case.
I have therefore corrected the code by:
if secure {
...
} else {
clipboardBytes = []byte(clipboard)
}
for Windows To avoid issues with escaping in the setLocalClip()
function, I use the clip
command instead and enable the "pipe".
like this:
func setLocalClip(s string) {
var copyCmd *exec.Cmd
switch runtime.GOOS {
case "windows":
copyCmd = exec.Command("clip")
default:
...
}
in, err := copyCmd.StdinPipe()
if err != nil {
handleError(err)
return
}
if err = copyCmd.Start(); err != nil {
handleError(err)
return
}
if _, err = in.Write([]byte(s)); err != nil {
handleError(err)
return
}
if err = in.Close(); err != nil {
handleError(err)
return
}
if err = copyCmd.Wait(); err != nil {
handleError(err)
return
}
}
Wow, nice work!
@quackduck, sorry to ask this way but could you please integrate the suggested patch and provide new binaries?
I did required changes here: https://github.com/meliksah/uniclip/releases/tag/v2.3.6
and created pr https://github.com/quackduck/uniclip/pull/16 but still if not using secure it is not working
Should work now!!!! Could someone test the latest commit to confirm?
it is working for me in secure mode
Does it not work in the regular mode?
Has this actually been closed/fixed? I notice on the latest release that normal or default launch mode doesn't seem to do anything, 2x Windows 11 instances connected to one-another for testing. In "--secure" mode it seems to blank out/override the clipboard as empty on the receiving end, but not actually transfer content.
I forgot to release lol. Try the latest commit.
Perhaps I'm being obtuse, but how do I go about doing that? The latest release appears to still be from April. Do you mean compiling it from source?
Yes that’s what I meanOn Mar 21, 2023, at 10:44 AM, SalmonSays @.***> wrote: Perhaps I'm being obtuse, but how do I go about doing that? The latest release appears to still be from April. Do you mean compiling it from source?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>
@SalmonSays I finally got around to releasing the fix. v2.3.6 has it. LMK if it works
Does not seem to work for me. I can send from Linux to Windows but Windows only prints:
error: [exit status 1]
in a loop.
What powershell do you need?
powershell.exe -command Get-Clipboard
The term 'Get-Clipboard' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ Get-Clipboard <<<<
+ CategoryInfo : ObjectNotFound: (Get-Clipboard:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there an alternative to powershell? Seems pretty wasteful. Go cannot access the clipboard or Win32 API directly?
Sorry for the dumb question I never did a project in Go (yet).
I am trying to connect my laptop (Windows 11) and my phone (Android 12) using version 2.3.5. The initial connection works as expected, but the clipboard isn't synchronized. In debug mode both instances report sending the clipboard contents, but apparently they don't receive anything.