Fix clipboard clearing on Windows

This commit is contained in:
2024-03-03 19:57:45 -05:00
parent 7a17df4aa3
commit 00e0a70ee6
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ func ClipClear(oldContents string) {
cmd := exec.Command("wl-paste")
newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\n") {
cmd := exec.Command("wl-copy", "-c")
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd = exec.Command("wl-copy", "-c")
cmd.Run()
}
os.Exit(0)
+2 -2
View File
@@ -42,8 +42,8 @@ func ClipClear(oldContents string) {
cmd := exec.Command("powershell.exe", "-c", "Get-Clipboard")
newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\n") {
cmd := exec.Command("powershell.exe", "-c", "Set-Clipboard")
if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd = exec.Command("powershell.exe", "-c", "Set-Clipboard")
cmd.Run()
}
os.Exit(0)