Feat: copy msg to clipboard; empty text to cancel edit; notify

This commit is contained in:
Grail Finder
2024-11-20 08:55:56 +03:00
parent aaf0566636
commit 74669b58fe
2 changed files with 46 additions and 15 deletions

View File

@@ -4,6 +4,8 @@ import (
"elefant/models"
"encoding/json"
"fmt"
"os/exec"
"strings"
"time"
)
@@ -90,3 +92,17 @@ func loadOldChatOrGetNew() []models.MessagesStory {
}
return history
}
func copyToClipboard(text string) error {
cmd := exec.Command("xclip", "-selection", "clipboard")
cmd.Stdin = nil
cmd.Stdout = nil
cmd.Stderr = nil
cmd.Stdin = strings.NewReader(text)
return cmd.Run()
}
func notifyUser(topic, message string) error {
cmd := exec.Command("notify-send", topic, message)
return cmd.Run()
}