diff options
author | Grail Finder <wohilas@gmail.com> | 2024-11-20 08:55:56 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2024-11-20 08:55:56 +0300 |
commit | 74669b58fe7b58b3d2fd4ad88c03890bc53a7a1a (patch) | |
tree | bce5129b5e403d8377cf194a7a93a663ed1de6fa /session.go | |
parent | aaf056663628f15bb6e4f23c899b6fd31bac5bf7 (diff) |
Feat: copy msg to clipboard; empty text to cancel edit; notify
Diffstat (limited to 'session.go')
-rw-r--r-- | session.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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() +} |