Created
January 23, 2022 04:00
-
-
Save suchipi/46dd77c1ad2c6f9d8fffd86d55abe7a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env suchibot | |
import { Keyboard, Key, record, Tape, isMouseEvent } from "suchibot"; | |
let tape: Tape | null = null; | |
Keyboard.onUp(Key.SCROLL_LOCK, () => { | |
if (tape && tape.isRecording) { | |
tape.stop(); | |
console.log("Stopped recording"); | |
} else { | |
if (tape) tape.stop(); | |
tape = record({ | |
eventFilter: (event) => { | |
if (isMouseEvent(event)) return true; | |
return !( | |
event.key === Key.SCROLL_LOCK || event.key === Key.PAUSE_BREAK | |
); | |
}, | |
}); | |
console.log("Recording to tape..."); | |
} | |
}); | |
Keyboard.onUp(Key.PAUSE_BREAK, async () => { | |
if (!tape) return; | |
console.log("Replaying tape..."); | |
await tape.play(); | |
console.log("Tape playback finished"); | |
}); | |
console.log("Recording system ready. Controls:"); | |
console.log(" Scroll Lock: Start/stop recording"); | |
console.log(" Pause/break: Replay recording"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
0.5.0 version: