summaryrefslogtreecommitdiffstats
path: root/pkg/gui/global_handlers.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-11-21 17:15:43 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-11-21 17:31:08 +1100
commit3e13936e08c5bb97fb96e68ca27b1e9739c16a50 (patch)
tree22ee7a2ca4560a91b44aa2eeb3dc63661403879d /pkg/gui/global_handlers.go
parenta3dfcd5a9502e482190b255f7964b97a2c55e074 (diff)
notify user upon copying something to clipboard
Diffstat (limited to 'pkg/gui/global_handlers.go')
-rw-r--r--pkg/gui/global_handlers.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index 77a93436b..a17e79b65 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -1,6 +1,7 @@
package gui
import (
+ "fmt"
"math"
"strings"
@@ -191,5 +192,13 @@ func (gui *Gui) handleCopySelectedSideContextItemToClipboard() error {
return nil
}
- return gui.OSCommand.CopyToClipboard(itemId)
+ if err := gui.OSCommand.CopyToClipboard(itemId); err != nil {
+ return gui.surfaceError(err)
+ }
+
+ truncatedItemId := utils.TruncateWithEllipsis(strings.ReplaceAll(itemId, "\n", " "), 50)
+
+ gui.raiseToast(fmt.Sprintf("'%s' %s", truncatedItemId, gui.Tr.LcCopiedToClipboard))
+
+ return nil
}