1 # Copyright 2020 Armaan Bhojwani
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Merge both global and local charfiles
19 cp -R /usr/share/charsel/* $CHARDIR/
20 cp -R ~/.local/share/* $CHARDIR/
25 # Check if user provided an input
26 [ -z "$1" ] && echo "No argument supplied" && exit
28 if [ $1 = "list" ]; then
29 echo "The following charfiles are installed"
35 CHARFILE=$CHARDIR/charfiles/$1
37 # Define length of shortcut
38 LENGTH=$(cat $CHARFILE | cut -f 1 -d ',' -s | wc -L | cut -b 1)
46 # Put charfile into table, showing only the shortcuts below the divider in the charfile
47 cat $CHARFILE | grep -A 100 - | tail -n +2 | column -t --output-separator ' | ' --separator ','
49 # Automatically enter input
52 # Navigate to the right characther
53 OUTPUT=$(grep $INPUT $CHARFILE | cut -f 2 -d ',' -s)
58 # Copy output to clipboard
59 echo $OUTPUT | xclip -selection clipboard