Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ BEMOJI_CUSTOM_LIST="" # the custom emoji list to display
BEMOJI_DOWNLOAD_LIST="" # the default emoji lists to download to database
BEMOJI_DEFAULT_COMMAND="" # which command to invoke by default
BEMOJI_PICKER_CMD="bemenu" # which picker tool to use
BEMOJI_CLIP_CMD="wl-copy" # which clipboard tool to use
BEMOJI_TYPE_CMD="wtype" # which typing tool to use (ydotool will NOT work)
BEMOJI_CLIP_CMD="wl-copy" # which clipboard tool to use // You can also type out full command xclip -selection clipboard
BEMOJI_TYPE_CMD="wtype" # which typing tool to use (ydotool will NOT work) // You can also type out full command xdotool tpye --delay 30
BEMOJI_PRIVATE_MODE=false # whether to save new entries
BEMOJI_LIMIT_RECENT="" # whether to display recent entries
BEMOJI_ECHO_NEWLINE=true # whether to end the output with a newline character
Expand Down
59 changes: 53 additions & 6 deletions bemoji
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,37 @@ add_to_recent() {
# Set default clipboard util
_clipper() {
if [ -n "$BEMOJI_CLIP_CMD" ]; then
# shellcheck disable=SC2068
${BEMOJI_CLIP_CMD[@]}
elif [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy >/dev/null 2>&1; then
read -r -a cmd_array <<< "$BEMOJI_CLIP_CMD"

if [ "${#cmd_array[@]}" -eq 1 ]; then
case "${cmd_array[0]}" in
wl-copy)
if command -v wl-copy >/dev/null 2>&1; then
wl-copy
return
fi
;;
xclip)
if command -v xclip >/dev/null 2>&1; then
xclip -selection clipboard
return
fi
;;
xsel)
if command -v xsel >/dev/null 2>&1; then
xsel -b
return
fi
;;
esac
else
# shellcheck disable=SC2068
${BEMOJI_CLIP_CMD[@]}
return
fi
fi

if [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy >/dev/null 2>&1; then
wl-copy
elif [ -n "$DISPLAY" ] && command -v xclip >/dev/null 2>&1; then
xclip -selection clipboard
Expand All @@ -249,9 +277,28 @@ _typer() {
totype=$(cat -)

if [ -n "$BEMOJI_TYPE_CMD" ]; then
# shellcheck disable=SC2068
${BEMOJI_TYPE_CMD[@]} "$totype"
return
read -r -a cmd_array <<< "$BEMOJI_TYPE_CMD"

if [ "${#cmd_array[@]}" -eq 1 ]; then
case "${cmd_array[0]}" in
wtype)
if command -v wtype >/dev/null 2>&1; then
wtype -s 30 "$totype"
return
fi
;;
xdotool)
if command -v xdotool >/dev/null 2>&1; then
xdotool type --delay 30 "$totype"
return
fi
;;
esac
else
# shellcheck disable=SC2068
${BEMOJI_TYPE_CMD[@]} "$totype"
return
fi
fi

if [ -n "$WAYLAND_DISPLAY" ] && command -v wtype >/dev/null 2>&1; then
Expand Down