summaryrefslogtreecommitdiff
path: root/.local/bin/fcode
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/fcode')
-rwxr-xr-x.local/bin/fcode8
1 files changed, 5 insertions, 3 deletions
diff --git a/.local/bin/fcode b/.local/bin/fcode
index 8da7a17..073bec4 100755
--- a/.local/bin/fcode
+++ b/.local/bin/fcode
@@ -3,9 +3,6 @@
# fzf-unicode: get a list of emojis or unicode charecters using fzf
# place your charecter files in plain text in ~/.local/share/chars/*
-FZF_HIST="$HOME/.local/share/fzf/unicode_history"
-mkdir -pv ~/.local/share/fzf
-
if [ "$OPENFLAG" = 0 ]; then
notify-send fzf-unicode "$*"
chosen="$(printf '%s\n' "$@" | cut -d\ -f1 | tr -d '\n')"
@@ -14,6 +11,11 @@ if [ "$OPENFLAG" = 0 ]; then
exit
fi
+[ -z "$FZF_HISTDIR" ] &&
+ export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf"
+mkdir -pv "$FZF_HISTDIR"
+export FZF_HIST="$FZF_HISTDIR/unicode_history"
+
cut -d ';' -f1 ~/.local/share/chars/* |
fzf -m --history="$FZF_HIST" \
--header="Copy Emojis to Clipboard" --header-first \