hacky program that maximizes silliness by playing sound effects on typing
  • Rust 60.4%
  • C 24.7%
  • Shell 13.4%
  • Nix 1.5%
2024-06-07 19:09:15 -05:00
.vscode stuff! 2024-04-12 17:15:32 -05:00
src stuff! 2024-04-12 17:15:32 -05:00
.gitignore delete identify.so 2024-04-12 18:06:05 -05:00
build-and-install.sh support nixos 2024-06-07 19:08:51 -05:00
Cargo.lock extremely late version bump 2024-04-15 09:08:41 -05:00
Cargo.toml extremely late version bump 2024-04-15 09:08:41 -05:00
identify.c stuff! 2024-04-12 17:15:32 -05:00
LICENSE add readme and license 2024-03-15 12:10:25 -05:00
README.md use absolute path 2024-04-21 15:36:12 -04:00
shell.nix support nixos 2024-06-07 19:08:51 -05:00
typewriter.c support nixos 2024-06-07 19:08:51 -05:00

typewriter

hacky program that maximizes silliness by playing sound effects on typing

dependencies

  • alsa-lib-devel
  • libevdev-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)

  1. 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)
  1. place the .wav files in src/
  2. run gcc typewriter.c -s -Werror -O3 -levdev -march=native -otypewriter.elf
  3. run sudo install --owner=root --group=root --mode=6755 -D typewriter.elf ~/.local/lib/typewriter.elf; this will install typewriter.elf in the location typewriter is expecting and setuid it
  4. run gcc identify.c -s -Werror -O3 -levdev -march=native -shared -fPIC -oidentify.so
  5. run install --mode=755 -D identify.so ~/.local/lib/identify.so
  6. run RUSTFLAGS="-C target-cpu=native" cargo install --path . (might need to be run in distrobox depending on your distro)

usage

  1. identify your keyboard with sudo ~/.cargo/bin/typewriter identify ~/.local/lib (evdevs that look like keyboards are bolded and have an asterisk before them)
  2. 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)