Skip to content

Instantly share code, notes, and snippets.

@exetico
Last active November 13, 2022 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exetico/cf744e36caf69e5440b515e7d7636f2b to your computer and use it in GitHub Desktop.
Save exetico/cf744e36caf69e5440b515e7d7636f2b to your computer and use it in GitHub Desktop.
Trigger OBS software to start/stop recordings with one command (Send key-presses to mulitple windows matching the same title)
# I'm using two OBS programs at the same time, to record two sources
# Therefore I need a simple way to start and stop both recordings at the same time
# Most of the time, a shortcut will trigger both windows - but not always
# And... I forget my normal shortcuts on/off
# Therefore I've added "Text Command" widget in KDE, and triggers the following command to start/stop my recording(s)
# You'll need to configure the shorts in OBS, for this to work
# Tested on Manjaro with KDE
# You don't have to do it in a one-liner, btw...
for i in $(xwininfo -root -tree | grep 'OBS '); do if [[ $i =~ ^0x[0-9A-Fa-f]{1,}$ ]]; then xdotool key --window "$i" ctrl+alt+0 ; fi; done
for i in $(xwininfo -root -tree | grep 'OBS '); do if [[ $i =~ ^0x[0-9A-Fa-f]{1,}$ ]]; then xdotool key --window "$i" ctrl+alt+9 ; fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment