Skip to content

Instantly share code, notes, and snippets.

@ekimekim
Created June 25, 2022 22:51
Show Gist options
  • Save ekimekim/e4fc757f86facad4bdc7aa3b67a26a25 to your computer and use it in GitHub Desktop.
Save ekimekim/e4fc757f86facad4bdc7aa3b67a26a25 to your computer and use it in GitHub Desktop.
#!/bin/bash
gen-keys() {
for control in "$@"; do
echo $enter "$control" $down
done
}
# weird key names
up=Up
down=Down
left=Left
right=Right
esc=Escape
enter=Return
backspace=BackSpace
if [ "$#" -lt 1 ]; then
echo "USAGE: $0 NAME" >&2
echo "Writes key sequence to set necrodancer control set of given name. Must start from the controls screen."
fi
if [ "$1" == "diamond" ]; then
CONTROLS=(
8
6
2
4
$backspace
$backspace
$backspace
$backspace
5
0
7
9
1
3
t
$backspace
)
elif [ "$1" == "main" ]; then
CONTROLS=(
w
d
s
a
$backspace
$backspace
$backspace
$backspace
space
shift
q
e
r
f
t
$backspace
)
else
echo "Available control sets: main, diamond"
exit 1
fi
KEYS=( $(gen-keys ${CONTROLS[@]}) ) # split on whitespace
xdotool search --name --limit 1 'Crypt of the NecroDancer' \
key --delay 75 $esc $enter $down "${KEYS[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment