1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2026-03-05 09:25:50 +01:00

Changed a way how stdin is copied in rofi-emoji script

This commit is contained in:
2023-01-18 13:45:43 +01:00
parent 28ac1bd446
commit ee5ac14f40
2 changed files with 33 additions and 29 deletions

View File

@@ -1,18 +1,37 @@
diff -ur rofi-emoji_orig/clipboard-adapter.sh rofi-emoji/clipboard-adapter.sh
--- rofi-emoji_orig/clipboard-adapter.sh 2022-10-08 09:43:38.033895494 +0200
+++ rofi-emoji/clipboard-adapter.sh 2022-10-08 10:06:06.297588512 +0200
@@ -54,6 +54,7 @@
diff --git a/clipboard-adapter.sh b/clipboard-adapter.sh
index af86763..b110c2c 100755
--- a/clipboard-adapter.sh
+++ b/clipboard-adapter.sh
@@ -53,7 +53,9 @@ main() {
exit 0
;;
copy)
perform_copy
+ perform_primary
- perform_copy
+ input="$(cat -)"
+ printf "%s" "$input" | perform_copy
+ printf "%s" "$input" | perform_primary
;;
insert)
# Also copy when doing insert to give users a fallback in case automatic
@@ -103,6 +104,30 @@
;;
"")
show_error "Could not find any tool to handle copying. Please install a clipboard handler."
@@ -112,6 +114,30 @@ perform_copy() {
esac
}
+perform_primary() {
+ tool=$(find_copy_tool)
+
+ case "$tool" in
+ xsel)
+ xsel --primary --input
+ ;;
+ xclip)
+ xclip -selection primary -in
+ ;;
+ wl-copy)
+ wl-copy --primary
+ ;;
+ "")
+ show_error "Could not find any tool to handle copying. Please install a clipboard handler."
+ exit 1
+ ;;
+ *)
@@ -22,21 +41,6 @@ diff -ur rofi-emoji_orig/clipboard-adapter.sh rofi-emoji/clipboard-adapter.sh
+ esac
+}
+
+perform_primary() {
+ tool=$(find_copy_tool)
+
+ case "$tool" in
+ xsel)
+ xsel --clipboard --output | xsel --primary --input
+ ;;
+ xclip)
+ xclip -selection clipboard -out | xclip -selection primary -in
+ ;;
+ wl-copy)
+ wl-copy --primary
+ ;;
+ "")
+ show_error "Could not find any tool to handle copying. Please install a clipboard handler."
exit 1
;;
*)
perform_insert() {
tool=$(find_insert_tool)