Question / Help Extra keyboard for macro/hot key

Gneistinn

New Member
I have been trying to find a way to add an extra keyboard, either full size or numpad, to use for hot keys but I haven't found any easy way to do this under Linux. Any tips?

I was also wonder what would happen if I'd connect a usb midi keyboard, would it be possible to use it for hot keys or am I just being silly? It would just be so convenient to add stickers to those keys - unlike a regular keyboard.
 

Gneistinn

New Member
I did this for myself using these instructions. You will need to follow them to make this work (very simple) but this might just save you a bit of typing.

I tried to make a unique combination of hot keys for everything but some might not be of any use to you so just change them if you like. My midi keyboard does not have all these keys but I can shift the octave up to simulate extra keys.

Simply put, if this script is running you can open the hot keys setting on OBS and instead of putting in e.g. alt+super+shift+6 you just press a note on the keyboard and a matching hot key will be entered. Then you should be able to use the keyboard for scene transitions and whatever.

I know that I know little about scripting and this one is just a "fill in the gaps" version of the script from the link above so if you can do it better, please share your way.

Code:
#!/bin/bash
aseqdump -p "INSERT OWN PORT OR DEVICE" | \
while IFS=" ," read src ev1 ev2 ch label1 data1 label2 data2 rest; do
    case "$ev1 $ev2 $data1" in
        "Note on 0" ) xdotool key alt+super+shift+1 ;;
        "Note on 1" ) xdotool key alt+super+shift+2 ;;
        "Note on 2" ) xdotool key alt+super+shift+3 ;;
        "Note on 3" ) xdotool key alt+super+shift+4 ;;
        "Note on 4" ) xdotool key alt+super+shift+5 ;;
        "Note on 5" ) xdotool key alt+super+shift+6 ;;
        "Note on 6" ) xdotool key alt+super+shift+7 ;;
        "Note on 7" ) xdotool key alt+super+shift+8 ;;
        "Note on 8" ) xdotool key alt+super+shift+9 ;;
        "Note on 9" ) xdotool key alt+super+shift+0 ;;
        "Note on 10" ) xdotool key alt+super+shift+q ;;
        "Note on 11" ) xdotool key alt+super+shift+w ;;
        "Note on 12" ) xdotool key alt+super+shift+e ;;
        "Note on 13" ) xdotool key alt+super+shift+r ;;
        "Note on 14" ) xdotool key alt+super+shift+t ;;
        "Note on 15" ) xdotool key alt+super+shift+y ;;
        "Note on 16" ) xdotool key alt+super+shift+u ;;
        "Note on 17" ) xdotool key alt+super+shift+i ;;
        "Note on 18" ) xdotool key alt+super+shift+o ;;
        "Note on 19" ) xdotool key alt+super+shift+p ;;
        "Note on 20" ) xdotool key alt+super+shift+a ;;
        "Note on 21" ) xdotool key alt+super+shift+s ;;
        "Note on 22" ) xdotool key alt+super+shift+d ;;
        "Note on 23" ) xdotool key alt+super+shift+f ;;
        "Note on 24" ) xdotool key alt+super+shift+g ;;
        "Note on 25" ) xdotool key alt+super+shift+h ;;
        "Note on 26" ) xdotool key alt+super+shift+j ;;
        "Note on 27" ) xdotool key alt+super+shift+k ;;
        "Note on 28" ) xdotool key alt+super+shift+l ;;
        "Note on 29" ) xdotool key alt+super+shift+z ;;
        "Note on 20" ) xdotool key alt+super+shift+x ;;
        "Note on 21" ) xdotool key alt+super+shift+c ;;
        "Note on 22" ) xdotool key alt+super+shift+v ;;
        "Note on 23" ) xdotool key alt+super+shift+b ;;
        "Note on 24" ) xdotool key alt+super+ctrl+1 ;;
        "Note on 25" ) xdotool key alt+super+ctrl+2 ;;
        "Note on 26" ) xdotool key alt+super+ctrl+3 ;;
        "Note on 27" ) xdotool key alt+super+ctrl+4 ;;
        "Note on 28" ) xdotool key alt+super+ctrl+5 ;;
        "Note on 29" ) xdotool key alt+super+ctrl+6 ;;
        "Note on 30" ) xdotool key alt+super+ctrl+7 ;;
        "Note on 31" ) xdotool key alt+super+ctrl+8 ;;
        "Note on 32" ) xdotool key alt+super+ctrl+9 ;;
        "Note on 33" ) xdotool key alt+super+ctrl+0 ;;
        "Note on 34" ) xdotool key alt+super+ctrl+q ;;
        "Note on 35" ) xdotool key alt+super+ctrl+w ;;
        "Note on 36" ) xdotool key alt+super+ctrl+e ;;
        "Note on 37" ) xdotool key alt+super+ctrl+r ;;
        "Note on 38" ) xdotool key alt+super+ctrl+t ;;
        "Note on 39" ) xdotool key alt+super+ctrl+y ;;
        "Note on 40" ) xdotool key alt+super+ctrl+u ;;
        "Note on 41" ) xdotool key alt+super+ctrl+i ;;
        "Note on 42" ) xdotool key alt+super+ctrl+o ;;
        "Note on 43" ) xdotool key alt+super+ctrl+p ;;
        "Note on 44" ) xdotool key alt+super+ctrl+a ;;
        "Note on 45" ) xdotool key alt+super+ctrl+s ;;
        "Note on 46" ) xdotool key alt+super+ctrl+d ;;
        "Note on 47" ) xdotool key alt+ctrl+shift+1 ;;
        "Note on 48" ) xdotool key alt+ctrl+shift+2 ;;
        "Note on 49" ) xdotool key alt+ctrl+shift+3 ;;
        "Note on 50" ) xdotool key alt+ctrl+shift+4 ;;
        "Note on 51" ) xdotool key alt+ctrl+shift+5 ;;
        "Note on 52" ) xdotool key alt+ctrl+shift+6 ;;
        "Note on 53" ) xdotool key alt+ctrl+shift+7 ;;
        "Note on 54" ) xdotool key alt+ctrl+shift+8 ;;
        "Note on 55" ) xdotool key alt+ctrl+shift+9 ;;
        "Note on 56" ) xdotool key alt+ctrl+shift+0 ;;
        "Note on 57" ) xdotool key alt+ctrl+shift+a ;;
        "Note on 58" ) xdotool key alt+ctrl+shift+s ;;
        "Note on 59" ) xdotool key alt+ctrl+shift+d ;;
        "Note on 60" ) xdotool key alt+ctrl+shift+f ;;
        "Note on 61" ) xdotool key alt+ctrl+shift+g ;;
        "Note on 62" ) xdotool key alt+ctrl+shift+h ;;
        "Note on 63" ) xdotool key alt+ctrl+shift+j ;;
        "Note on 64" ) xdotool key alt+ctrl+shift+k ;;
        "Note on 65" ) xdotool key alt+ctrl+shift+z ;;
        "Note on 66" ) xdotool key alt+ctrl+shift+x ;;
        "Note on 67" ) xdotool key alt+ctrl+shift+c ;;
        "Note on 68" ) xdotool key alt+ctrl+shift+v ;;
        "Note on 69" ) xdotool key alt+ctrl+shift+b ;;
        "Note on 70" ) xdotool key ctrl+super+shift+1 ;;
        "Note on 71" ) xdotool key ctrl+super+shift+2 ;;
        "Note on 72" ) xdotool key ctrl+super+shift+3 ;;
        "Note on 73" ) xdotool key ctrl+super+shift+4 ;;
        "Note on 74" ) xdotool key ctrl+super+shift+5 ;;
        "Note on 75" ) xdotool key ctrl+super+shift+6 ;;
        "Note on 76" ) xdotool key ctrl+super+shift+7 ;;
        "Note on 77" ) xdotool key ctrl+super+shift+8 ;;
        "Note on 78" ) xdotool key ctrl+super+shift+9 ;;
        "Note on 79" ) xdotool key ctrl+super+shift+0 ;;
        "Note on 80" ) xdotool key ctrl+super+shift+q ;;
        "Note on 81" ) xdotool key ctrl+super+shift+w ;;
        "Note on 82" ) xdotool key ctrl+super+shift+e ;;
        "Note on 83" ) xdotool key ctrl+super+shift+r ;;
        "Note on 84" ) xdotool key ctrl+super+shift+t ;;
        "Note on 85" ) xdotool key ctrl+super+shift+y ;;
        "Note on 86" ) xdotool key ctrl+super+shift+u ;;
        "Note on 87" ) xdotool key ctrl+super+shift+i ;;
        "Note on 88" ) xdotool key ctrl+super+shift+o ;;
        "Note on 89" ) xdotool key ctrl+super+shift+p ;;
        "Note on 90" ) xdotool key ctrl+super+shift+a ;;
        "Note on 91" ) xdotool key ctrl+super+shift+s ;;
        "Note on 92" ) xdotool key ctrl+super+shift+d ;;
        "Note on 93" ) xdotool key alt+super+1 ;;
        "Note on 94" ) xdotool key alt+super+2 ;;
        "Note on 95" ) xdotool key alt+super+3 ;;
        "Note on 96" ) xdotool key alt+super+4 ;;
        "Note on 97" ) xdotool key alt+super+5 ;;
        "Note on 98" ) xdotool key alt+super+6 ;;
        "Note on 99" ) xdotool key alt+super+7 ;;
        "Note on 100" ) xdotool key alt+super+8 ;;
        "Note on 101" ) xdotool key alt+super+9 ;;
        "Note on 102" ) xdotool key alt+super+0 ;;
        "Note on 103" ) xdotool key alt+super+q ;;
        "Note on 104" ) xdotool key alt+super+w ;;
        "Note on 105" ) xdotool key alt+super+e ;;
        "Note on 106" ) xdotool key alt+super+r ;;
        "Note on 107" ) xdotool key alt+super+t ;;
        "Note on 108" ) xdotool key alt+super+y ;;
        esac
done
 
Last edited:
Top