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") cmd := exec.Command("wl-paste")
newContents, _ := cmd.Output() newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\n") { if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd := exec.Command("wl-copy", "-c") cmd = exec.Command("wl-copy", "-c")
cmd.Run() cmd.Run()
} }
os.Exit(0) os.Exit(0)
+2 -2
View File
@@ -42,8 +42,8 @@ func ClipClear(oldContents string) {
cmd := exec.Command("powershell.exe", "-c", "Get-Clipboard") cmd := exec.Command("powershell.exe", "-c", "Get-Clipboard")
newContents, _ := cmd.Output() newContents, _ := cmd.Output()
if oldContents == strings.TrimRight(string(newContents), "\n") { if oldContents == strings.TrimRight(string(newContents), "\r\n") {
cmd := exec.Command("powershell.exe", "-c", "Set-Clipboard") cmd = exec.Command("powershell.exe", "-c", "Set-Clipboard")
cmd.Run() cmd.Run()
} }
os.Exit(0) os.Exit(0)