I patched and compiled Synergy to enable the Kana key used in Japanese keyboards to switch between input methods. I also created the Windows installer for the patched version for those Windows users that do not know what a patch is or what compiling means. You can find the installer here.
Unfortunately for Linux users I have no idea on how to create packages for any distribution so you will have to compile from sources. Fear not as it is not complicated at all and I explain how to do it below.
A dual screen hack (revisited):
In one of my previous post I talked about how I used X2VNC/Win2VNC in combination with RealVNC/X11VNC to share a single keyboard and mouse between several computers even if these computers had different operating systems.
Using the above programs works well but I have been experiencing some problems like not being able to use the Japanese keys on my keyboard and some responsiveness degradation (late mouse reaction) when the machine running the VNC server is under heavy load.
Due to these small problems I started looking for an alternative and found Synergy. This application is small and does not require the additional VNC server. Runs in Windows, Linux and Mac and the transition between screens is smooth even if the computers are under heavy load. Another thing I like a lot is the centralized configuration (only one server) that allows to easily configure more than two computers. Creating a setup with more than three computers using X2VNC/WIN2VNC could be very frustrating. Also there are GUI configuration tools for Windows, Linux and Mac that make even easier to setup (here).
There are a lot of resources in the Internet that explain how to install and use Synergy to create dual screen systems (here, here and here) so I wont explain it here. What I will explain is how to get the Japanese keys to work with synergy.
Some videos of Synergy in action can be found here
Japanese Key's support in Synergy
The current version of Synergy does not handle the Japanese keys used to change the input method (i.e. ローマ字/漢字). There is a Japanese keyboard (Hankaku/Zenkaku-Kanji and Kana key) patch in the patches section of the Synergy sourceforge page but no binary releases are available yet. I took the time to patch and compile the source code to enable these keys on my Japanese keyboard in Linux and Windows and here are the instructions on how I did it.
Instructions for Linux Kubuntu Desktop
1. Download the source code from here. The last version was 1.3.1 at the time of this writing.
2. Make sure you have installed the development tools and the XTest development package
sudo aptitude install build-essential
sudo aptitude install libxtst-dev
3. Unpack and edit the source code
tar xvfz synergy-1.3.1.tar.gz
cd synergy-1.3.1
4. Edit the source code to add Hankaku/Zenkaku-Kanji and Kana key support
Open the lib/platform/CMSWindowsKeyState.cpp file and search the following three lines:
/* 0x0f2 */ { kKeyNone }, // OEM specific
/* 0x0f3 */ { kKeyNone }, // OEM specific
/* 0x0f4 */ { kKeyNone }, // OEM specific
and replace them with these corresponding lines
/* 0x0f2 */ { kKeyOEMCopy }, // VK_OEM_COPY
/* 0x0f3 */ { kKeyZenkaku }, // VK_OEM_AUTO
/* 0x0f4 */ { kKeyZenkaku }, // VK_OEM_ENLW
Open the lib/synergy/KeyTypes.h file and search for a line like:
static const KeyID kKeyDelete = 0xEFFF; /* Delete, rubout */
and add the following below:
static const KeyID kKeyOEMCopy = 0xEF27; /* OEMCopy(Kana Key) */
Actually you can add this line of code anywhere you want inside the KeyTypes.h file but to keep things in order I add it after the kKeyDelete const declaration.
5. Make the configure/make/make install dance.
./configure -x-includes /usr/include -x-libraries /usr/lib --prefix=/usr
make
sudo make install
6. Synergy is now installed on your Kubuntu system and you can proceed to configure it. Refer to the links in the previous section for instructions.
Instruction for Windows
1. To compile Synergy in Windows you need Visual C++ (Express Edition) that can be downloaded for free from here.
2. To create the installer we need NSIS. Simply download the installable from here and install it.
3. Download the source code (synergy.1.3.1.zip), unpack it somewhere. Edit the file "dist/nullsoft/installer.mak" inside the source code to make sure it points to the correct NSIS installation path. Simply open the installer.mak file with any text editor and make sure the path for makensis is correct:
NSIS="C:\Program Files\NSIS\makensis"
This example is if you installed NSIS in the default path.
3. Open the synergy.dsw VC++ project. Say yes to all the requests to convert the project format and edit the source code as directed below
Open the platform->Source Files->CMSWindowsKeyState.cpp file and search these six lines:
/* 0x0f2 */ { kKeyNone }, // OEM specific
/* 0x0f3 */ { kKeyNone }, // OEM specific
/* 0x0f4 */ { kKeyNone }, // OEM specific
and replace them with these corresponding lines
/* 0x0f2 */ { kKeyOEMCopy }, // VK_OEM_COPY
/* 0x0f3 */ { kKeyZenkaku }, // VK_OEM_AUTO
/* 0x0f4 */ { kKeyZenkaku }, // VK_OEM_ENLW
Open the libsynergy->Header File->KeyTypes.h file and add the following line:
static const KeyID kKeyOEMCopy = 0xEF27; /* OEMCopy(Kana Key) */
just after this line:
static const KeyID kKeyDelete = 0xEFFF; /* Delete, rubout */
If you followed the Linux instructions you will note that these changes are exactly the same as does we did in Linux.
4. Make sure the compiler is set to Release configuration (i.e. select release in the project properties) and build the "all" and "installer" projects. To compile right click on the project names (all and installer) and select build from the context menu.
5. After both builds finish there will be a "SynergyInstaller.exe" file inside the "build" directory inside the source code directory. Execute this file to install Synergy as normal.
6. Proceed to configure (see references in previous section) and now you will be able to change from romaji to kana using the Kana key available on all japanese keyboards.
Mac Instructions
Unfortunately I do not have a Mac to try this patch but there are instructions on how to compile Synergy on a Mac inside the doc/compiling.html file. If someone is successful applying this patch on the Mac I would like to hear about it.
No comments:
Post a Comment