Autoscroll using xdotool
I've been reading without autoscroll for a while, and found out that I missed it a bit too much. I wrote this simple bash script to auto scroll in the viewer alone.
Please keep in mind, since I have not built in an exit condition, the only way to stop the auto scroll is to press Ctrl+C on the terminal window that this script is running on. Avoid this script if you are unfamiliar with the terminal.
Code:
----------------------------------------------
#!/bin/bash
#xdotool script to autoscroll on Calibre viewer, adaptable for other viewers
input='a'
while [ $input=='a' ]
do
if [[ "$(xdotool getwindowfocus getwindowname)" =~ .*iewer.* ]]
then xdotool key Down
fi
sleep 0.04
done
----------------------------------------------
Instructions to install:
Save this code to .autoscroll.sh in the home folder of Ubuntu
NOTE: You need to navigate and call this script every time you want to initiate auto scroll so choose name and path accordingly
Open terminal
type "chmod 777 .autoscroll.sh" and hit enter
Instructions to run:
Open the book of your preference in the calibre viewer
type "./.autscroll.sh" and hit enter
Change tabs to the viewer. Auto scrolling will automatically commence. It will stop if you leave the window completely (minimize/open some other window)
To stop scrolling, go the the terminal window and hit Ctrl+C
Explanation of code:
Hits the down key every 0.04 seconds.
Adjust the sleep 'gap' line according to your reading speed
This is very rudimentary code, please suggest improvements.
|