correct function name
This commit is contained in:
parent
cd7024ff25
commit
022899ced8
16
snippy
16
snippy
@ -64,6 +64,12 @@ bashdown(){
|
|||||||
done < <(cat "${DIR}/${FILE}")
|
done < <(cat "${DIR}/${FILE}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_gui(){
|
||||||
|
name="$(xprop -id "$(xdotool getwindowfocus)" WM_CLASS | cut -d'"' -f2 | tr '[:upper:]' '[:lower:]')"
|
||||||
|
[[ "$name" =~ term|tilda ]] && return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
run(){
|
run(){
|
||||||
cd "${DIR}" || exit
|
cd "${DIR}" || exit
|
||||||
# Use the filenames in the snippy directory as menu entries.
|
# Use the filenames in the snippy directory as menu entries.
|
||||||
@ -109,14 +115,14 @@ run(){
|
|||||||
|
|
||||||
xsel -b --input < "$TMPFILE"
|
xsel -b --input < "$TMPFILE"
|
||||||
# Paste into the current application.
|
# Paste into the current application.
|
||||||
if is_window; then
|
if is_gui; then
|
||||||
${GUIPASTE}
|
${GUIPASTE}
|
||||||
|
|
||||||
if [[ $cursor -gt 0 ]]; then
|
if [[ $cursor -gt 0 ]]; then
|
||||||
local keyup
|
local keyup
|
||||||
until [ $cursor -eq 0 ]; do
|
until [ $cursor -eq 0 ]; do
|
||||||
keyup+="Up "
|
keyup+="Up "
|
||||||
let cursor-=1
|
((cursor-=1))
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
xdotool key --delay -0.1 $keyup
|
xdotool key --delay -0.1 $keyup
|
||||||
done
|
done
|
||||||
@ -128,10 +134,4 @@ run(){
|
|||||||
echo -ne "$current_clip" | xsel -b --input
|
echo -ne "$current_clip" | xsel -b --input
|
||||||
}
|
}
|
||||||
|
|
||||||
is_window(){
|
|
||||||
name="$(xprop -id "$(xdotool getwindowfocus)" WM_CLASS | cut -d'"' -f2 | tr '[:upper:]' '[:lower:]')"
|
|
||||||
[[ "$name" =~ term|tilda ]] && return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
run
|
run
|
||||||
|
Loading…
Reference in New Issue
Block a user