The last time I showed a simple script for looking up words and automatically making a list of them, which is useful while watching a video or playing a game, but what about taking screenshots?
With my new script you can look up words and take screenshots at the same time from a SSH shell.
I recommend you to to connect to SSH from your cellphone, here you have my script:
#! /bin/bash
export DISPLAY=:0
while true; do
read -p key HE
if [ "$HE" == "y" ]; then
scrot
elif [ "$HE" == "q" ]; then
exit
else
clear
a=$(wn "$HE" -over)
echo "$a"
if [ ! -z "$a" ]; then
echo $HE >> words
fi
fi
done
This script reads your input, if you type “y”, then it will take a screenshot and save it in the current directory, elif you type “q”, it will exit; else, any other word will be looked up it in the dictionary and its definition will be showed, if the the word exits, then it will be saved in a text file called “words”.
You first need to install scrot and wordnet in order to use this script.
I first tried to switch to a TTY and take a screenshot from there, but that’s a bad idea, you cannot take a screenshot if you are in a TTY console, if you try so then you will get a black picture or nothing will happen . You may delay it, but switching to a TTY while playing a game is per se a pretty bad thing to do.
Besides, connecting to a SSH shell is one of the easiest things in Linux.
For android I recommended you Termux as a terminal emulator, there you can install SSH with “apt install openssh”, then connect to your computer using:
ssh user@ip
User is your computer username, and ip is your local ip, you can get your local ip with the command ifconfig in the inet line.
Note: Some games such as Steam allow to take screenshots, however this method will work for any game.
Home Remote Control
This application allows to use your cellphone as a remote touch-pad and keyboard, also allows to take screenshots and includes many media controls, everything with SSH. Of course you can open a shell too. I even bought the pro version of this applications because I really liked. Its opensource: Apache License, Version 2.0