Copy clipboard history selection with Shift Return
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
# omarchy:summary=Copy text to the clipboard and type or paste it
|
||||
# omarchy:group=clipboard
|
||||
# omarchy:args=[--shift-insert] [--history-index <index>|<text>]
|
||||
# omarchy:args=[--shift-insert] [--copy-only] [--history-index <index>|<text>]
|
||||
# omarchy:examples=omarchy clipboard paste text "hello" | omarchy clipboard paste text --shift-insert "hello"
|
||||
|
||||
use_shift_insert=false
|
||||
copy_only=false
|
||||
history_index=""
|
||||
text=""
|
||||
|
||||
@@ -15,6 +16,10 @@ while [[ $# -gt 0 ]]; do
|
||||
use_shift_insert=true
|
||||
shift
|
||||
;;
|
||||
--copy-only)
|
||||
copy_only=true
|
||||
shift
|
||||
;;
|
||||
--history-index)
|
||||
history_index="${2:-}"
|
||||
shift 2
|
||||
@@ -35,13 +40,19 @@ copy_history_entry() {
|
||||
|
||||
if [[ -n $history_index ]]; then
|
||||
copy_history_entry
|
||||
use_shift_insert=true
|
||||
if [[ $copy_only != "true" ]]; then
|
||||
use_shift_insert=true
|
||||
fi
|
||||
else
|
||||
text=${1:-}
|
||||
[[ -n $text ]] || exit
|
||||
printf '%s' "$text" | wl-copy
|
||||
fi
|
||||
|
||||
if [[ $copy_only == "true" ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
sleep 0.15
|
||||
|
||||
if [[ $use_shift_insert == "true" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user