diff options
author | Julian Weigt <julian.weigt@gmail.com> | 2020-04-26 20:02:35 +0300 |
---|---|---|
committer | Julian Weigt <julian.weigt@gmail.com> | 2020-04-26 20:02:35 +0300 |
commit | 0f85fcc3fac833b1635af111e1a7024254fcf3c6 (patch) | |
tree | ec8018ac0e992fae4c882c196b91f9907aad5198 /ui/commands.go | |
parent | 96bb87e8ac8f45d56d487ea6c16d67f057d97e1f (diff) |
Implement copying to clipboard
"github.com/atotto/clipboard"
Diffstat (limited to 'ui/commands.go')
-rw-r--r-- | ui/commands.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/commands.go b/ui/commands.go index 4dd1482..27c9caf 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -34,6 +34,7 @@ import ( "github.com/lucasb-eyer/go-colorful" "github.com/russross/blackfriday/v2" + "github.com/atotto/clipboard" "maunium.net/go/mautrix" "maunium.net/go/mautrix/event" @@ -158,6 +159,7 @@ const ( SelectRedact = "redact" SelectDownload = "download" SelectOpen = "open" + SelectCopy = "copy" ) func cmdReply(cmd *Command) { @@ -176,6 +178,14 @@ func cmdOpen(cmd *Command) { cmd.Room.StartSelecting(SelectOpen, strings.Join(cmd.Args, " ")) } +func cmdCopy(cmd *Command) { + if clipboard.Unsupported { + cmd.Reply("Clipboard unsupported.") + } else { + cmd.Room.StartSelecting(SelectCopy, strings.Join(cmd.Args, " ")) + } +} + func cmdReact(cmd *Command) { if len(cmd.Args) == 0 { cmd.Reply("Usage: /react <reaction>") |