]> git.armaanb.net Git - charsel.git/blobdiff - charsel
Small changes to improve usability
[charsel.git] / charsel
diff --git a/charsel b/charsel
index 811372365b78d759b029ecd09fdc229870262246..01f1d3f4d7f18fc8e9ea1999bcdb8331ea6eafec 100755 (executable)
--- a/charsel
+++ b/charsel
@@ -1,11 +1,30 @@
 #!/usr/bin/env sh
 
-CHARDIR=~/.local/share/charsel
+# Merge both global and local charfiles
+cp /usr/share/charsel/* ~/.cache/charsel/
+cp ~/.local/share/charsel/* ~/.cache/charsel/
+CHARDIR=~/.cache/charsel
 
-column -t $CHARDIR/$1 -N SHORT,CHAR -R SHORT,CHAR --output-separator '    |    '
-read INPUT
+# Check if user provided a charfile
+[ -z "$1" ] && echo "No argument supplied"  && exit 1
 
-OUTPUT=$(grep $INPUT $CHARDIR/$1 | cut -c 3)
+# Clear screen
+clear
 
-echo $OUTPUT
-echo $OUTPUT | xclip -selection clipboard
+while :
+do
+  
+  # Put charfile into table
+  column -t $CHARDIR/$1 -N SHORT,CHAR -R SHORT,CHAR --output-separator ' | '
+  read 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
+  echo $OUTPUT | xclip -selection clipboard
+done