shell-keystroke-animator
Simulate stroking keyboard keys into another application/window while taking screenshots to create a .gif
animation.
Create repeatable, editable, automatable example usage of:
- Terminal/shell programs.
- Code snippets.
- Proof-of-concept for hacks.
- Other text input.
Installation
On Mac with Homebrew:
brew tap joelpurra/joelpurra
brew install shell-keystroke-animator
On other systems:
Clone or download, then either use shell-keystroke-animator/src/keystroke-animator
directly where you put it, or symlink keystroke-animator
. Required bash 4+ and ImageMagick. Note that shell-keystroke-animator
is not expected to work on anything but Mac OS X, without modifications.
Examples
Usage
Quickly focus another application/window, where you want your keystrokes to go and animation be created from, as soon as you’ve started keystroke-animator
.
Running the software creates a series of .png
images, and an output.gif
in the same folder you started it from ($PWD
).
cat "my-keys.txt" | keystroke-animator [--no-shadow] [countdown [keysleep [linesleep [endsleep]]]]
my-keys.txt
Sequence of keys/characters to read fromstdin
and then “type”, one by one.--no-shadow
Turn off application window shadows (optional). Useful if the background of the window isn’t white.countdown
Pre-script countdown, in integer seconds (optional).keysleep
Time to sleep between keys, in seconds (optional).linesleep
Time to sleep between lines, in seconds (optional).endsleep
Time to sleep at the end of the animation, in seconds (optional).
Limitations
- Doesn’t work great with Terminal commands which take longer than
linesleep
to execute fully. - The software isn’t designed to handle special characters. Only linebreaks (
\n
) are treated differently, and is sent as the ↵ (return) key. - Tested on Mac OS X 10.10 Yosemite - please add support for any other platforms you like!
Kudos
ttygif
andttyrec
For inspiration. Shame I couldn’t get those programs to work properly.- houbysoft’s/ AskDifferent answer to the question Can a Mac be programmed to simulate pressing a key at a certain rate via software?
License
Copyright (c) 2015 Joel Purra https://joelpurra.com/ All rights reserved.
When using shell-keystroke-animator, comply to the MIT license. Please see the LICENSE file for details.