OBS "insert current timestamp" hotkey

In the CircuitPython weekly meetings, one of the things the host does is record the timestamps of parts of the meeting into the notes document.

To facilitate this, I've created an OBS script that can be configured with a global hotkey. Then, just press the hotkey to insert OBS's idea of the current timestamp into any program.

A friend reports that when obs is installed as a snap, it can't run other programs installed as debian packages, so this doesn't work at all.

It uses the program "xte" (debian package name: xautomation) on Linux to fake keypresses, and there's a spot where you would customize the script if you use another operating system-- Windows and Mac both have their own packages for making fake keypresses or using any other method that may be available to insert the text. (for instance, putting the timestamp in the operating system paste buffer and then synthesizing a press of the "paste" hotkey)

I found that xte would sometimes drop keypresses, so now I'm trying xdotool:

if sysname == 'Linux':
    import subprocess
    def fake_keyboard(s):
        subprocess.run(["xdotool", "type", s])



Entry first conceived on 9 August 2021, 23:44 UTC, last modified on 7 February 2022, 16:31 UTC
Website Copyright © 2004-2024 Jeff Epler