about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2022-01-24 20:42:58 -0500
committerZach DeCook <zachdecook@librem.one>2022-01-24 21:05:33 -0500
commit42347937a7d554cc4ffad0851d2a2fc0452f93dc (patch)
tree2701388688f0d2a2e37233d2382b2448312b74ea
parenta8cb10f119b8f3244d003c6733cdd16c2079ab55 (diff)
downloadswipeGuess-42347937a7d554cc4ffad0851d2a2fc0452f93dc.tar.gz
Readme: Update for c rewrite v0.2.0
Remove old shell version because it's slow.
-rw-r--r--README.md18
-rw-r--r--functions.sh6
-rwxr-xr-xmakeDir.sh10
-rwxr-xr-xswipeGuess.sh34
4 files changed, 6 insertions, 62 deletions
diff --git a/README.md b/README.md
index 0756440..81f37ee 100644
--- a/README.md
+++ b/README.md
@@ -4,15 +4,13 @@ swipeGuess is a completion program intended to be used as a plugin for touchscre
 
 For each line input from stdin, it looks through a wordlist and outputs the first possible match for that gesture.
 
-it's run like `input-program | swipeGuess.sh wordlist | output-program`
+it's run like `input-program | swipeGuess wordlist.txt | output-program`
 
 ## input-program
 
 The input program should output a stream of letters "swiped through", then a newline.
 
-There's a WIP Merge Request towards proycon's wvkbd for an example of this.
-
-=> https://github.com/proycon/wvkbd/pull/1
+This is supported by [wvkbd](https://github.com/proycon/wvkbd) since version 0.6.
 
 ## wordlist
 
@@ -49,11 +47,6 @@ map.tsv uses tabs and newlines to create the grid-based layout. See `map.qwerty.
 If your keys are in a hexagonal layout, use mapScore like
 `./mapScore.py map.simple.tsv bee`.
 
-### alternate formats
-
-Alternatively, for performance, you can use a directory with the following format: each file is named with the first and last letters of the contained words.
-The script `makeDir.sh` is provided to help create these.
-
 ## output-program
 
 * `completelyTypeWord.sh` (included in this repository) will type the characters (besides the first character, which is already typed by wvkbd) using wtype.
@@ -61,6 +54,7 @@ The script `makeDir.sh` is provided to help create these.
 # Installation/Usage with wvkbd
 
 1. Be using a wayland-based graphical shell (such as sway)
-2. copy swipeGuess.sh and completelyTypeWord.sh into your $PATH (`~/.local/bin/` or `/usr/local/bin/` for example)
-3. `wvkbd-mobintl -O | swipeGuess.sh /path/to/words.txt | completelyTypeWord.sh`
-	* In SXMO, `KEYBOARD_ARGS='-O | swipeGuess.sh /path/to/words.txt | completelyTypeWord.sh'` can be added to your ~/.profile to enable this (effective on restart).
+2. Compile with your favorite C compiler: `gcc swipeGuess.c -o swipeGuess`.
+2. copy swipeGuess completelyTypeWord.sh into your $PATH (`~/.local/bin/` or `/usr/local/bin/` for example)
+3. `wvkbd-mobintl -O | swipeGuess /path/to/words.txt | completelyTypeWord.sh`
+	* In SXMO, `KEYBOARD_ARGS='-O | swipeGuess /path/to/words.txt | completelyTypeWord.sh'` can be added to your ~/.profile to enable this (effective on restart).
diff --git a/functions.sh b/functions.sh
deleted file mode 100644
index 440219b..0000000
--- a/functions.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-firstLetter(){
-	echo "$1"|grep -o '^.'
-}
-lastLetter(){
-	echo "$1"|grep -o '.$'
-}
diff --git a/makeDir.sh b/makeDir.sh
deleted file mode 100755
index 5c2d5c0..0000000
--- a/makeDir.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-dir="$1"
-mkdir -p "$dir"
-rm "$dir/"*
-source "$(dirname "$0")/functions.sh"
-while read -r line; do
-	fl=$(firstLetter "$line")
-	ll=$(lastLetter "$line")
-	echo "$line" >> "$dir/$fl$ll"
-done
diff --git a/swipeGuess.sh b/swipeGuess.sh
deleted file mode 100755
index 71e811d..0000000
--- a/swipeGuess.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-source "$(dirname "$0")/functions.sh"
-
-swipeToQuery(){
-	swipe=$(echo "$1" | tr -d ".\*\"\\^$\(\)")
-	printf '^'
-	printf '%s\\+%s' "${swipe:0:1}" "${swipe:1:1}"
-	if test "${swipe:2}"; then
-		printf "${swipe:2}" |grep -o . | xargs -I{} printf '*%s' "{}"
-	fi
-	printf '\+$'
-}
-
-query(){
-	swipe="$2"
-	wordlist="$1"
-	wordfile="$wordlist"
-	if test -d "$wordlist"; then
-		wordfile=/dev/null
-		fl=$(firstLetter "$swipe")
-		ll=$(lastLetter "$swipe")
-		test -f "$wordlist/$fl$ll" && wordfile="$wordlist/$fl$ll"
-	fi
-
-	query=$(swipeToQuery "$swipe")
-	echo "query: $query" > /dev/stderr
-	# -m 1: just give first result
-	grep -i -m 1 "$query" "$wordfile"
-}
-
-while read -r line; do
-	test "$line" && query "$1" "$line" && printf '\n'
-done