Sunday, 13 March 2016

Sharing MacBook Pro's Keyboard and TouchPad with other Linux Machine

Introduction

I have a Dell Laptop (Fedora-23) connected to my Big screen TV via HDMI cable. I use Kodi to watch movies on TV. Though Kodi can be controlled via its web interface, but I wanted to control other things as well in Linux remotely via my MacBook pro. I found http://synergy-project.org/ as one of solution to this problem. Although it is an Open Source Project, they do not provide installers free of cost. So I performed following steps to build Synergy for my MacBook pro and Linux both.

Note: I tried VNC but was not happy with it.

Build Synergy for MacBook Pro:
I am running OSX 10.11.3. You may have to install XCODE. Additionally I am using HomeBrew as well.
You have to install "QT" on MacBook pro. I installed it using HomeBrew. I installed "4.8.7_1" QT.
$ brew install qt
$ brew install cmake
$ git clone http://github.com/symless/synergy
$ cd synergy

make changes to  ext/toolchain/commands1.py file as per https://github.com/symless/synergy/wiki/Compiling#Mac_OS_X_1010_and_above
I ran following commands to make relevant changes.
$ cd ext/toolchain/
$ perl -i -wnl -e 'm!(.*)elif sys\.platform == "darwin":(.*)! and print "$1if sys.platform == \"darwin\":$2" or print ' commands1.py
$ perl -i -wnl -e 'm!(.*)frameworkRootDir = ! and print "$1frameworkRootDir = \"/usr/local/Cellar/qt/4.8.7_1/Frameworks\"" or print ' commands1.py

$ cd ../../
$ ./hm.sh conf -g1 --mac-sdk 10.11 --mac-identity `hostname`
$ ./hm.sh build
$ ./hm.sh package mac
Mac package .dmg will be created. Install that .dmg file. First time it will not run and gives error.
To run it , Under system preference -> Security & Privacy -> Accessibility -> check Synergy .
Run Synergy (GUI app) and set it up as server.

Build synergy on Fedora-23
$ git clone http://github.com/symless/synergy
$ cd synergy

Follow instructions in https://github.com/symless/synergy/wiki/Compiling#Unix_Linux_Mac_OS_X (in short these consists of following steps)
$ ./hm.sh conf -g1
$ ./hm.sh build
$ ./hm.sh package rpm

RPM will be generated like following.
bin/synergy-master-beta-7a207b4-Linux-x86_64.rpm
Install above generated RPM. This Linux laptop will be client to Synergy Master running on MacBook Pro.
I use following command on my Linux Laptop to connect it to Synergy Master.
$ synergyc -f 192.168.0.7

192.168.0.7 is the IP ADDRESS of my MacBook Pro.
I usually run it in a screen session as following.

$ screen -S synergy synergyc -f 192.168.0.7
Once it is connected, MacBook Pro's mouse and keyboard can be shared in all three devices i.e (MacBook Pro, Linux Laptop and TV).

No comments:

Post a Comment