#!/bin/bash # Dependencies: tesseract-ocr imagemagick scrot xsel wikit wikx set -e SCR_IMG=$(mktemp) trap 'rm $SCR_IMG*' EXIT scrot -s "$SCR_IMG.png" mogrify -modulate 100,0 -resize 400% "$SCR_IMG.png" #should increase detection rate tesseract "$SCR_IMG.png" "$SCR_IMG" &> /dev/null tr -d '\014' <$SCR_IMG.txt >words.txt src=$(cat words.txt) rofi="rofi -dmenu -yoffset 30 -location 2" phrase="$(echo $src | eval $rofi -markup -p 'Lookup: ')" wikit $phrase -d --line 80 > list.txt list=$(cat list.txt) selected="$(echo "$list" | rofi -dmenu -p 'Select ')" pag() { \ eval "$rofi" -l 20 -p 'Done' } phrase=$(echo "$selected"|eval "$rofi" -markup -p 'Lookup ') { wikit "$phrase" --line 80 --link } | pag