Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mosesaro

macrumors member
Original poster
Aug 18, 2009
60
0
New York
Hello everybody, I am trying to build a small app and post on github for others to use.



I am trying to remap the volume up and down on my mac keyboard to control the volume on my amplifier. Right now my main concern is creating a daemon that will listen for the key press and send the appropriate command. The amplifier uses telnet. It works send things. The amp does respond back with a new volume, but I will work with that later. I know swift, but I cannot figure out how to create a daemon.



host=192.168.0.2

port=8102
cmd1='VU' //Volume up
cmd2='VD' //Volume down

( echo open ${host} ${port}
sleep 1
echo ${cmd1}
sleep 1
echo ${cmd2}
sleep 1

echo exit ) | telnet

Long story short
How do I create a daemon, that listens to keys pressed on keyboard in background and sends appropriate telnet command to receiver.
 
I would start with a normal GUI app. Create a view with control buttons. One for volume up, one for volume down, another for whatever function, etc. In order to talk to the receiver, open a TCP connection to that host and port and start sending the commands over the socket. You don't need 'telnet' to do that for you. After you get that working, you can try and attach to your volume keys. I would probably write the app as a menu bar app eventually.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.