I've coded a Bash script for Kobo eReaders (https://github.com/tux-linux/Kobo-network-display-viewer) that displays a Linux-based computer screen on it. Here's a rough resume of how it works:
1. Gnome-screenshot takes real-time screenshots of the screen, which are put in /tmp and are constantly replaced.
2. Screenshot is sent via SCP, SSH to the /tmp directory of the Kobo, which is hosting a small Linux system.
3. I use a library to display the image on the screen: https://github.com/NiLuJe/FBInk
4. The process starts all over again, leading to constant (as constant as I could write it to be) image update on the eInk screen.
Well, that seems OK. But the problem I have is that eInk screen have a lifespan. And when an eInk screen constantly updates, second after second, an image on the screen, at some point it will inevitably (I think) cause some wear.
But a big good thing about these screen is that if you leave a still image on it, it will not wear, except for the time it takes to display it.
So, what I'd like to do is to 'trap' or 'pause' the 'while' process (the code is below) when the host machine's screenshots are the same, to still display the image on the screen (which will stay there because of the eInk screen), but leave it there and not update it until 'diff' or a command like that finds a difference in it.
I'm little noob in Bash programming, so any help would be greatly appreciated.
Here's the code:
while :; do read -r -p 'IP: ' ip && break; done
while :; do read -r -p "Your Kobo device screen width resolution: " width && break; done
while :; do read -r -p "Your Kobo device screen height resolution: " height && break; done
sshpass -p test ssh root@$ip 'watch -n 30 "fbink -H -k -f | tee -a output.txt" &>/dev/null &'
while true; do gnome-screenshot -p --file=/tmp/continuous.png && sshpass -p test scp /tmp/continuous.png root@$ip:/tmp && sshpass -p test ssh root@$ip 'fbink -g file=/tmp/continuous.png,w='$width',h='$height''; done
FYI, the 'fbink -k -f' thing is to refresh the screen every 30 seconds.
Thanks for your time!