From 74669b58fe7b58b3d2fd4ad88c03890bc53a7a1a Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 20 Nov 2024 08:55:56 +0300 Subject: Feat: copy msg to clipboard; empty text to cancel edit; notify --- session.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'session.go') diff --git a/session.go b/session.go index 769fe90..59baab4 100644 --- a/session.go +++ b/session.go @@ -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() +} -- cgit v1.2.3