From 3bc57b459389fa0ad3285c87cb0fbd581e3a91a4 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sat, 4 Oct 2025 19:24:15 +0200 Subject: [PATCH] Use clipboard manager with image support --- .../.local/share/scripts/cliphist-rofi-img | 22 +++++++++++++++++++ sway/.config/sway/config | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100755 scripts/.local/share/scripts/cliphist-rofi-img diff --git a/scripts/.local/share/scripts/cliphist-rofi-img b/scripts/.local/share/scripts/cliphist-rofi-img new file mode 100755 index 0000000..d11fadf --- /dev/null +++ b/scripts/.local/share/scripts/cliphist-rofi-img @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +tmp_dir="/tmp/cliphist" +rm -rf "$tmp_dir" + +if [[ -n "$1" ]]; then + cliphist decode <<<"$1" | wl-copy + exit +fi + +mkdir -p "$tmp_dir" + +read -r -d '' prog <$tmp_dir/"grp[1]"."grp[3]) + print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3] + next +} +1 +EOF +cliphist list | gawk "$prog" diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 207ac42..250cfcf 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -284,7 +284,7 @@ bindsym XF86Favorites exec mpc next # Program keybindings # # clipman -bindsym $mod+c exec clipman pick -t rofi --max-items=50 +bindsym $mod+c exec rofi -modi clipboard:~/.local/share/scripts/cliphist-rofi-img -show clipboard -show-icons # grim bindsym Print exec grim # slurp + grim to clipboard @@ -326,7 +326,8 @@ output eDP-1 color_profile icc ~/.config/colord/E14-G3.icm # Autostart programs # # clipman -exec wl-paste -t text --watch clipman store --max-items=50 +exec wl-paste -t text --watch cliphist store +exec wl-paste -t image --watch cliphist store # kanshi exec kanshi # easyeffects