/fcitx-remote-for-windows

A fake fcitx-remote for Windows

Primary LanguageC++

fcitx-remote-for-windows

This is a fake fcitx-remote for Windows so that it can be used by fcitx.el. Inspired by fcitx-remote-for-osx.

For Vim users: This program might also be able to be used by fcitx.vim. I haven’t tested it and I probably won’t since I don’t use Vim myself. If you’re interested, help me out by submitting PRs or reporting issues.

Build Instructions

Build by Yourself

You can change the key combination to toggle the input method if you build the program by yourself.

In current code, ALT+SHIFT is set as the default key combination to toggle the input method.

This project is built from Visual Studio 2013. Import the project into Visual Studio and build the executable file.

Use pre-built releases

You can download the pre-built releases in the GitHub project homepage. Two versions available:

Choose the one that fits you.

Windows Setup

This program toggles the input method by simulating ALT+SHIFT or WIN+SPACE keys, which means you need to make sure you can use ALT+SHIFT or WIN+SPACE to switch between English and Chinese input method.

Emacs Setup

If you’re using WIN+SPACE to toggle the input method, add the following settings to your init.el so that WIN+SPACE can be handled by the Windows instead of Emacs:

(setq w32-pass-lwindow-to-system nil)
(setq w32-lwindow-modifier 'super)

Also, make sure fcitx-remote is in your PATH and exec-path. If not, use the following code in your init.el:

(let ((fcitx-path "C:/path/to/fcitx-remote"))
  (setenv "PATH" (concat fcitx-path ";" (getenv "PATH")))
  (add-to-list 'exec-path fcitx-path))

Problems

Currently this program works great, but still has some minor problems:

  1. SendInput can’t guarantee the keyboard input sequence it has sent to be processed before it returns. In some sense, it is not fully synchronized (please correct me if I’m wrong). Therefore, sometimes if you’re typing really fast, the input method may not be closed before your next input. I noticed this when I tested the prefix-keys feature of fcitx.el.
  2. ALT+SHIFT or WIN+SPACE is not configurable right now.

TODO

  • Better implementation instead of using SendInput.
  • Make the toggle key (ALT+SHIFT or WIN+SPACE) configurable.
  • Support more command line options. Currently only -c and -o are supported. fcitx-remote will print the status in all the other cases. The current approach is already enough to make fcitx.el work properly.
  • Check Vim plugin compatibility: help needed, since I don’t use Vim myself.