Compare commits
3 commits
59d436a944
...
302bc0ebf4
Author | SHA1 | Date | |
---|---|---|---|
302bc0ebf4 | |||
71d5dc455d | |||
32fc9f45dd |
4 changed files with 26 additions and 6 deletions
|
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
<!-- ### Added -->
|
### Added
|
||||||
|
|
||||||
|
- Pass through return code 1 from selection tool
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -22,7 +24,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
<!-- ### Removed -->
|
<!-- ### Removed -->
|
||||||
|
|
||||||
<!-- ### Fixed -->
|
### Fixed
|
||||||
|
|
||||||
|
- Always download from newest emoji list url
|
||||||
|
- Pass selection to custom typing tools through stdin
|
||||||
|
|
||||||
<!-- ### Security -->
|
<!-- ### Security -->
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,8 @@ BEMOJI_CLIP_CMD="path/to/your/clipboard/tool"
|
||||||
BEMOJI_TYPE_CMD="path/to/your/xdotool"
|
BEMOJI_TYPE_CMD="path/to/your/xdotool"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The candidate list (in the case of picker tool) or the picked selection are passed to the tools through stdin.
|
||||||
|
|
||||||
This is pretty experimental and you'll have to see how well it works for you.
|
This is pretty experimental and you'll have to see how well it works for you.
|
||||||
The setting can not be changed through the commandline alone.
|
The setting can not be changed through the commandline alone.
|
||||||
|
|
||||||
|
|
11
bemoji
11
bemoji
|
@ -98,7 +98,7 @@ prepare_db() {
|
||||||
|
|
||||||
dl_default_emoji() {
|
dl_default_emoji() {
|
||||||
local emojis
|
local emojis
|
||||||
emojis=$(curl -sSL "https://unicode.org/Public/emoji/14.0/emoji-test.txt")
|
emojis=$(curl -sSL "https://unicode.org/Public/emoji/latest/emoji-test.txt")
|
||||||
printf "%s" "$emojis" | sed -ne 's/^.*; fully-qualified.*# \(\S*\) \S* \(.*$\)/\1 \2/gp' >"$bm_db_location/emojis.txt"
|
printf "%s" "$emojis" | sed -ne 's/^.*; fully-qualified.*# \(\S*\) \S* \(.*$\)/\1 \2/gp' >"$bm_db_location/emojis.txt"
|
||||||
printf "Downloaded default emoji set.\n"
|
printf "Downloaded default emoji set.\n"
|
||||||
}
|
}
|
||||||
|
@ -165,11 +165,14 @@ _clipper() {
|
||||||
|
|
||||||
# Set default typing uti
|
# Set default typing uti
|
||||||
_typer() {
|
_typer() {
|
||||||
totype=$(cat -)
|
|
||||||
if [ -n "$BEMOJI_TYPE_CMD" ]; then
|
if [ -n "$BEMOJI_TYPE_CMD" ]; then
|
||||||
# shellcheck disable=SC2068
|
# shellcheck disable=SC2068
|
||||||
${BEMOJI_TYPE_CMD[@]}
|
${BEMOJI_TYPE_CMD[@]}
|
||||||
elif [ -n "$WAYLAND_DISPLAY" ] && command -v wtype >/dev/null 2>&1; then
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
totype=$(cat -)
|
||||||
|
if [ -n "$WAYLAND_DISPLAY" ] && command -v wtype >/dev/null 2>&1; then
|
||||||
wtype -s 30 "$totype"
|
wtype -s 30 "$totype"
|
||||||
elif [ -n "$DISPLAY" ] && command -v xdotool >/dev/null 2>&1; then
|
elif [ -n "$DISPLAY" ] && command -v xdotool >/dev/null 2>&1; then
|
||||||
xdotool type --delay 30 "$totype"
|
xdotool type --delay 30 "$totype"
|
||||||
|
@ -206,7 +209,7 @@ result=$(echo "$result" | grep -o '^\S\+' | tr -d '\n')
|
||||||
|
|
||||||
case "$exit_value" in
|
case "$exit_value" in
|
||||||
1)
|
1)
|
||||||
exit
|
exit 1
|
||||||
;;
|
;;
|
||||||
0)
|
0)
|
||||||
if [ ${#bm_cmds[@]} -eq 0 ]; then
|
if [ ${#bm_cmds[@]} -eq 0 ]; then
|
||||||
|
|
|
@ -54,6 +54,11 @@ setup() {
|
||||||
typing result"
|
typing result"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "Passes selection to custom typer tool through stdin" {
|
||||||
|
BEMOJI_TYPE_CMD="cat -" run bemoji -t 3>&-
|
||||||
|
assert_output "❤️"
|
||||||
|
}
|
||||||
|
|
||||||
@test "Runs custom default command" {
|
@test "Runs custom default command" {
|
||||||
BEMOJI_DEFAULT_CMD="echo my custom command" run bemoji 3>&-
|
BEMOJI_DEFAULT_CMD="echo my custom command" run bemoji 3>&-
|
||||||
assert_output "my custom command"
|
assert_output "my custom command"
|
||||||
|
@ -64,6 +69,11 @@ typing result"
|
||||||
assert_output "my clipping"
|
assert_output "my clipping"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "Returns status code 1 on picker status code 1" {
|
||||||
|
BEMOJI_PICKER_CMD="return 1" run bemoji -e 3>&-
|
||||||
|
assert_failure 1
|
||||||
|
}
|
||||||
|
|
||||||
@test "Prints output with newline by default" {
|
@test "Prints output with newline by default" {
|
||||||
bats_require_minimum_version 1.5.0
|
bats_require_minimum_version 1.5.0
|
||||||
BEMOJI_PICKER_CMD="echo heart" run --keep-empty-lines -- bemoji -e
|
BEMOJI_PICKER_CMD="echo heart" run --keep-empty-lines -- bemoji -e
|
||||||
|
|
Loading…
Reference in a new issue