I wanted a way to control my pc while i'm lying in bed, without the use of a wireless keyboard/mouse. I would use it primarily when i'm watching some movie/series, to play/pause it or control the volume.
Considering that i wanted to play/pause the video and control the volume, i thought that the best way to do this is using the Fn keys on the keyboard. After searching the simplest way to do it, using the programming languages that i already know, i ended with the combination of Java + Autohotkey. I use Java for the server and basic keyboard/mouse controls and Autohotkey to trigger the Fn keys, since i couldn't find an easy way to do this with Java.
The easiest way that i found to access the server, running on my PC, from my cellphone is by fixing my IP address. After doing that, i can simply use that IP to access a front-end page that i made with HTML + Javascript + JQuery which contains some controls that send the commands to the server.
- Java 1.8+
- Java JDK 1.8+
- Autohotkey
- Some IDE with Maven, like Eclipse or VS Code
- Clone the repository:
$ git clone https://github.com/nogenem/control-pc.git-
Open the project with an IDE / Code editor.
- With Eclipse, you should open it in the folder that you did the
git cloneand then go intoFile > Import... > Maven > Existing Maven Projects....- Make sure that the project is running with JRE 1.8+.
- Right click the "JRE System Library" and click on "Properties".
- Check if the "JavaSE-1.8 (jdk1.8.x_xxx)" is selected, or a higher version.
- Make sure that the project is running with JRE 1.8+.
- With Eclipse, you should open it in the folder that you did the
-
Copy the file
.env.exampleand rename it to.env.- You can edit the values inside the file as you please, but the default ones will work fine.
- If you want to create a new
KeyStore.jksfile, you can use the following command:
$ keytool -genkey -alias control-pc -keyalg RSA -keystore KeyStore.jks -keysize 2048-
Open the Main.java file and click on "Run as...".
-
You can now open http://localhost:7777/ and start controlling your PC.
- If you fixed your IP address, you can access the front-end on your cellphone too, using the same port (7777).
- Download the latest release.
- Extract the .zip file.
- Open a terminal and navigate to the extracted folder.
cd /path/to/control-pc- Execute the following command:
java -jar control-pc.jar-
You can now open http://localhost:7777/ and start controlling your PC.
- If you fixed your IP address, you can access the front-end on your cellphone too, using the same port (7777).

