Fix Eclipse keyboard shortcuts with non-Latin layouts on GNU/Linux

·1 min read·paskov

I ran into an annoying bug in Eclipse on GNU/Linux when switching between keyboard layouts. Shortcuts such as Ctrl+C and Ctrl+V worked with the English layout but stopped working when I switched to Bulgarian.

After some searching, I found eclipse-hotkeys-fix, a workaround by amozzhuhin. It provides a shared library and a launcher script for Eclipse.

Update: This bug was later fixed for Eclipse 4.7.2. The workaround below is for older affected installations.

Building the workaround

Build the library against the same GTK version used by your Eclipse installation. These steps follow the project’s build instructions and use GTK 3.

On Debian or Ubuntu, install the build tools and GTK development package:

sudo apt-get install git cmake build-essential libgtk-3-dev

Download and build the library:

git clone https://github.com/amozzhuhin/eclipse-hotkeys-fix.git
mkdir eclipse-hotkeys-fix-build
cd eclipse-hotkeys-fix-build
cmake -DGTK3=1 ../eclipse-hotkeys-fix
make

For GTK 2, install libgtk2.0-dev instead of libgtk-3-dev and omit -DGTK3=1 from the CMake command.

Starting Eclipse with the workaround

Close Eclipse. Copy lib/libeclipse-hotkeys-fix.so and eclipse.sh from the build directory into the directory containing the Eclipse executable.

From that directory, make the launcher executable and run it:

chmod +x eclipse.sh
./eclipse.sh

Use this launcher whenever you need the workaround, then switch keyboard layouts and check that the shortcuts work.