#!/usr/bin/env sh
# Merge both global and local charfiles
-cp /usr/share/charsel/* ~/.cache/charsel/
-cp ~/.local/share/charsel/* ~/.cache/charsel/
-CHARDIR=~/.cache/charsel
+CHARDIR=/tmp/charsel
+cp /usr/share/charsel/* $CHARDIR
+cp ~/.local/share/charsel/* $CHARDIR
# Check if user provided a charfile
[ -z "$1" ] && echo "No argument supplied" && exit 1
# Put charfile into table
column -t $CHARDIR/$1 -N SHORT,CHAR -R SHORT,CHAR --output-separator ' | '
- read INPUT
+ read -n 1 INPUT
# Navigate to the right characther
OUTPUT=$(grep $INPUT $CHARDIR/$1 | cut -c 3)
# Clear screen
clear
- # Print output, and copy to clipboard
- echo $OUTPUT
+ # Copy output to clipboard
echo $OUTPUT | xclip -selection clipboard
done