Skip to content

Instantly share code, notes, and snippets.

@uahim
Last active August 20, 2020 14:40
Show Gist options
  • Save uahim/a7ffb97d98cd61165906ba69e998a16a to your computer and use it in GitHub Desktop.
Save uahim/a7ffb97d98cd61165906ba69e998a16a to your computer and use it in GitHub Desktop.
#!/bin/bash
#requires Cygwin, netcat, Autohotkey, focus_firefox.ahk and Nircmdc on Windows
while true
do
content=$(echo foobar | nc.exe -l -p 999 | sed -r -n "$ s/\n//;$ p")
cmd /c focus_firefox.ahk
if test $content = "volup"
then
cmd /c nircmdc sendkeypress up
elif test $content = "voldown"
then
cmd /c nircmdc sendkeypress down
elif test $content = "mute"
then
cmd /c nircmd sendkeypress m
elif test $content = "minimize"
then
cmd /c nircmd sendkeypress esc
elif test $content = "pause"
then
cmd /c nircmdc sendkeypress spc
elif test $content = "prev"
then
cmd /c nircmdc sendkeypress left left & nircmdc sendkey left left
elif test $content = "next"
then
cmd /c nircmdc sendkeypress right right & nircmdc sendkey right right
elif test $content = "fullscreen"
then
cmd /c nircmdc sendkeypress f
elif test $content = "skip"
then
cmd /c nircmdc sendkeypress s
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment