- Rust 60.4%
- C 24.7%
- Shell 13.4%
- Nix 1.5%
| .vscode | ||
| src | ||
| .gitignore | ||
| build-and-install.sh | ||
| Cargo.lock | ||
| Cargo.toml | ||
| identify.c | ||
| LICENSE | ||
| README.md | ||
| shell.nix | ||
| typewriter.c | ||
typewriter
hacky program that maximizes silliness by playing sound effects on typing
dependencies
alsa-lib-devellibevdev-devel- a minecraft installation using prism launcher (i have no idea what versions work but i use 1.20.1)
- a oneshot installation
- ffmpeg
- gcc
- jq
- rust and cargo
- sudo
- yt-dlp
- probably others i'm not aware of :spinny_cat:
building
run ./build-and-install.sh <PATH_TO_ONESHOT_INSTALLATION> <PRISM_LAUNCHER_DATA_DIR> <OPTIONAL_DISTROBOX_CONTAINER_NAME> where PATH_TO_ONESHOT_INSTALLATION is your oneshot installation, PRISM_LAUNCHER_DATA_DIR is the path to prism launcher's data directory, and OPTIONAL_DISTROBOX_CONTAINER_NAME is either nothing or a distrobox container name
example: ./build-and-install.sh /home/niko/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common/OneShot/ /home/niko/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher fedora
example… TWO: ./build-and-install.sh /home/niko/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common/OneShot/ /home/niko/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher
building manually (avoids dependency on oneshot and minecraft)
- find/transcode 4 .wav files for typing sounds:
- bwomp.wav: backspace
- meow.wav: any threes typed after a colon (or semicolon)
- pc_on.wav: enter
- text.wav: any other key (except repeated w, a, s, d, space, left meta (super), and arrow keys)
- place the .wav files in
src/ - run
gcc typewriter.c -s -Werror -O3 -levdev -march=native -otypewriter.elf - run
sudo install --owner=root --group=root --mode=6755 -D typewriter.elf ~/.local/lib/typewriter.elf; this will installtypewriter.elfin the location typewriter is expecting and setuid it - run
gcc identify.c -s -Werror -O3 -levdev -march=native -shared -fPIC -oidentify.so - run
install --mode=755 -D identify.so ~/.local/lib/identify.so - run
RUSTFLAGS="-C target-cpu=native" cargo install --path .(might need to be run in distrobox depending on your distro)
usage
- identify your keyboard with
sudo ~/.cargo/bin/typewriter identify ~/.local/lib(evdevs that look like keyboards are bolded and have an asterisk before them) - run
typewriter <PATH_TO_EVDEV>
example: typewriter /dev/input/event2
typewriter.c
this c code is technically a keylogger, but it only gives a very vague magic number
it also gets setuid'd to root by the build script because /dev/input/event* is owned by root and cannot be read otherwise (unless you wannya give every program access to them by adding yourself to the input group)
if you compile typewriter.c with -D DEBUG_MODE=true, the resulting binyary will output the key name and code instead of the usual vague magic values (used for development; don't do this when building normally or this program will Not Work)