Fix SC2015
This commit is contained in:
parent
271b7227b4
commit
4bf3e46660
42
snippy
42
snippy
@ -163,8 +163,11 @@ move_cursor() {
|
|||||||
init() {
|
init() {
|
||||||
# Check basic dependency
|
# Check basic dependency
|
||||||
local all_needed_programs_installed=true
|
local all_needed_programs_installed=true
|
||||||
[[ $is_wayland ]] && local needed_programs=( wofi fzf wtype wl-copy wl-paste jq ) \
|
if [[ $is_wayland ]]; then
|
||||||
|| local needed_programs=( rofi fzf xsel xclip jq xdotool )
|
local needed_programs=( wofi fzf wtype wl-copy wl-paste jq )
|
||||||
|
else
|
||||||
|
local needed_programs=( rofi fzf xsel xclip jq xdotool )
|
||||||
|
fi
|
||||||
for program in "${needed_programs[@]}"; do
|
for program in "${needed_programs[@]}"; do
|
||||||
if ! command -v "$program" >/dev/null 2>&1; then
|
if ! command -v "$program" >/dev/null 2>&1; then
|
||||||
all_needed_programs_installed=false
|
all_needed_programs_installed=false
|
||||||
@ -409,11 +412,17 @@ run() {
|
|||||||
|
|
||||||
# Copy snippet in clipboard
|
# Copy snippet in clipboard
|
||||||
if is_rich_snippet "${snippets_directory}/${snippet}"; then
|
if is_rich_snippet "${snippets_directory}/${snippet}"; then
|
||||||
[[ $is_wayland ]] && wl-copy --type text/html -o < "$tmpfile" \
|
if [[ $is_wayland ]]; then
|
||||||
|| xclip -target text/html -selection clipboard -in -loops 1 < "$tmpfile"
|
wl-copy --type text/html -o < "$tmpfile"
|
||||||
else
|
else
|
||||||
[[ $is_wayland ]] && wl-copy < "$tmpfile" \
|
xclip -target text/html -selection clipboard -in -loops 1 < "$tmpfile"
|
||||||
|| xsel --clipboard --input < "$tmpfile"
|
fi
|
||||||
|
else
|
||||||
|
if [[ $is_wayland ]]; then
|
||||||
|
wl-copy < "$tmpfile"
|
||||||
|
else
|
||||||
|
xsel --clipboard --input < "$tmpfile"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$paste" = true ] ; then
|
if [ "$paste" = true ] ; then
|
||||||
@ -422,12 +431,18 @@ run() {
|
|||||||
# We need a little pause to handle the time to focus on the window
|
# We need a little pause to handle the time to focus on the window
|
||||||
sleep "$focus_wait"
|
sleep "$focus_wait"
|
||||||
# Paste
|
# Paste
|
||||||
[[ $is_wayland ]] && wtype -M ctrl v -m ctrl -s "$focus_wait_ms" \
|
if [[ $is_wayland ]]; then
|
||||||
|| xdotool key ctrl+v sleep "$focus_wait"
|
wtype -M ctrl v -m ctrl -s "$focus_wait_ms"
|
||||||
|
else
|
||||||
|
xdotool key ctrl+v sleep "$focus_wait"
|
||||||
|
fi
|
||||||
move_cursor "Up" $cursor_line_position
|
move_cursor "Up" $cursor_line_position
|
||||||
else
|
else
|
||||||
[[ $is_wayland ]] && wtype -M ctrl -M shift v -m ctrl -m shift -s "$focus_wait_ms" \
|
if [[ $is_wayland ]]; then
|
||||||
|| xdotool key ctrl+shift+v sleep "$focus_wait"
|
wtype -M ctrl -M shift v -m ctrl -m shift -s "$focus_wait_ms"
|
||||||
|
else
|
||||||
|
xdotool key ctrl+shift+v sleep "$focus_wait"
|
||||||
|
fi
|
||||||
if is_vim; then
|
if is_vim; then
|
||||||
move_cursor "Up" $cursor_line_position
|
move_cursor "Up" $cursor_line_position
|
||||||
fi
|
fi
|
||||||
@ -439,8 +454,11 @@ run() {
|
|||||||
sleep "$focus_wait"
|
sleep "$focus_wait"
|
||||||
|
|
||||||
# Restore current clipboard
|
# Restore current clipboard
|
||||||
[[ $is_wayland ]] && echo -ne "$current_clipboard" | wl-copy \
|
if [[ $is_wayland ]]; then
|
||||||
|| echo -ne "$current_clipboard" | xsel --clipboard --input
|
echo -ne "$current_clipboard" | wl-copy
|
||||||
|
else
|
||||||
|
echo -ne "$current_clipboard" | xsel --clipboard --input
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user