feat(ctl): clipboard hist
This commit is contained in:
parent
52af6a81fe
commit
e84a22dbcb
2 changed files with 21 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
21
scripts/ctl
21
scripts/ctl
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue