summaryrefslogtreecommitdiff
path: root/rofi/.config
diff options
context:
space:
mode:
authorbh <qn+git@excalibur.computer>2026-03-07 18:48:40 +0800
committerbh <qn+git@excalibur.computer>2026-03-07 18:48:40 +0800
commit9a5cd8cd5087e92ca62e26e120add0e3aee23e7f (patch)
treed7e75cea07f8f76d425a5ccd0b6c9a9d55d8ae40 /rofi/.config
parent6828b78ca81b14d90d3ddfa25c942cbd581f7451 (diff)
Add wayland support for clipboard
Diffstat (limited to 'rofi/.config')
-rwxr-xr-xrofi/.config/rofi/clipboard-wayland.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/rofi/.config/rofi/clipboard-wayland.sh b/rofi/.config/rofi/clipboard-wayland.sh
new file mode 100755
index 0000000..93789a0
--- /dev/null
+++ b/rofi/.config/rofi/clipboard-wayland.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+clipboard_mode() {
+ if [ "$ROFI_RETV" = "0" ]; then
+ cliphist list | while IFS= read -r line; do
+ id="${line%% *}"
+ content="${line#* }"
+
+ if [[ "$content" == *"[[ binary data"* ]]; then
+ printf '󰋩 IMAGE: %s\0info\x1f%s\n' "$id" "$id"
+ else
+ printf '%s\0info\x1f%s\n' "$content" "$id"
+ fi
+ done
+ else
+ cliphist decode "$ROFI_INFO" | wl-copy
+ exit 0
+ fi
+}
+
+export -f clipboard_mode
+
+if [ -z "$ROFI_RETV" ]; then
+ rofi -modi "clipboard:$0" \
+ -show clipboard \
+ -theme ~/.config/rofi/clipboard.rasi
+else
+ clipboard_mode "$@"
+fi