feat(ctl): clipboard hist

This commit is contained in:
Barrett Ruth 2026-03-03 15:29:49 -05:00
parent 52af6a81fe
commit e84a22dbcb
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 21 additions and 2 deletions

View file

@ -129,7 +129,7 @@ bind = , XF86Tools, submap, scripts
submap = scripts
bind = , A, exec, hyprctl dispatch submap reset; ctl audio sink
bind = , C, exec, hyprctl dispatch submap reset; sh -lc 'cliphist list | fuzzel --width 65 --dmenu --prompt="copy: " | cliphist decode | wl-copy'
bind = , C, exec, hyprctl dispatch submap reset; ctl clip
bind = , I, exec, hyprctl dispatch submap reset; ctl idle
bind = , K, exec, hyprctl dispatch submap reset; ctl keyboard next
bind = , M, exec, hyprctl dispatch submap reset; ctl media

View file

@ -485,6 +485,25 @@ else:
sys.exit(1)
PYTHON
;;
clip)
require fuzzel cliphist wl-copy
entries=$(cliphist list)
[ -z "$entries" ] && exit 0
count=$(printf '%s\n' "$entries" | wc -l)
lines=$((count < 15 ? count : 15))
chosen=$(printf '%s\n' "$entries" |
awk -F'\t' '{
content = substr($0, index($0, "\t") + 1)
display = (length(content) > 63) ? substr(content, 1, 60) "..." : content
printf " %s\t%s\n", display, $1
}' |
fuzzel --dmenu --no-icons --prompt="clip: " \
--with-nth=1 --accept-nth=2 --font="monospace:size=12" \
--lines="$lines" --width=75)
[ -z "$chosen" ] && exit 0
original=$(printf '%s\n' "$entries" | awk -F'\t' -v id="$chosen" '$1==id{print;exit}')
printf '%s' "$original" | cliphist decode | wl-copy
;;
power)
require fuzzel
lock="󰌾 Lock"
@ -514,7 +533,7 @@ idle)
fi
;;
*)
echo "Usage: ctl {screenshot|keyboard|audio|wifi|brightness|volume|media|wallpaper|power|idle}" >&2
echo "Usage: ctl {screenshot|keyboard|audio|wifi|brightness|volume|media|wallpaper|power|idle|clip}" >&2
exit 1
;;
esac