I have an Alphasmart Neo, which emulates a keyboard when connected to a computer to send text files. It basically works like a very fast typist. When it hits an accented character it tries to use the Windows alt key combinations to insert them.

For example the é character is sent as Alt + 0 2 3 3. Of course this only sends nonsense under Linux because it handles special characters differently.

I cannot change the way files are sent from the device.

I was wondering if there was a way to temporarily emulate these Alt Windows keystrokes under Linux so that the files are sent correctly.

  • maybe helpful: unix.stackexchange.com/questions/117027/… – Fabian Jun 20 '18 at 10:08
  • As awful as it sounds, you may need to use a program that gets the raw input from the keyboard "device" and handles the codes itself. I do not know of such a program. – Ignacio Vazquez-Abrams Jun 20 '18 at 10:15
  • @Fabian thanks, it seems that the Linux Console (Ctrl+Alt+F1) allows Alt codes and sending a file there works. However I was hoping for a way to emulate this in the GUI. – Andrea Jun 20 '18 at 10:16
  • @IgnacioVazquez-Abrams That is what I was worried about. I was hoping for a simpler way to do this. – Andrea Jun 20 '18 at 10:17
  • Now that I think more, an IBus engine could probably be written to handle this, but is outside of my expertise. – Ignacio Vazquez-Abrams Jun 20 '18 at 10:22

So there seems to be a workaround. The Linux console (Ctrl+Alt+F1) allows Alt codes and sending a file there works.

However, I was hoping to emulate this in the GUI. But it seems to be quite hard to do this unless some low level programming is enabled. I will not accept this answer for a few hours in case anyone has another solution.

| improve this answer | |
  • Note: according to this, "few" is at least about 48. :) – Kamil Maciorowski Jun 20 '18 at 10:26
  • @KamilMaciorowski ok sorry my mistake – Andrea Jun 20 '18 at 11:56
  • Neither a mistake nor something to be sorry about. I just let you know the site won't let you accept this answer for few days. – Kamil Maciorowski Jun 20 '18 at 11:58

Not exactly what you're asking for, but similar enough that it will probably still work:

Many (but not all) IME frameworks (including both ibus and fctix) on Linux support a library called m17n to provide IME's. The m17n library provides a bunch of easy to use IME's (including trivial keyboard remappings to handle various languages). One of these, simply called 'Unicode', happens to do almost exactly the same thing as alt codes. The only two differences are:

  • Alt codes depend on what your system's code page is for legacy applications. The m17n 'Unicode' IME uses hexadecimal Unicode code points, which are 100% consistent no matter how else the system is configured.
  • Alt codes require you to hold the Alt key and use the numeric keypad to enter the digits. The m17n 'Unicode' IME uses Ctrl-U as the trigger sequence, and lets you enter the code any way you want (provided it matches the required hex code).

So, for your example of a lowercase latin letter 'e' with an acute accent, the exact sequence for m17m's 'Unicode' IME would be Ctrl-U 0 0 e 9. Numerically, the hexadecimal number 00e9 is actually identical to the 0233 decimal value used for the equivalent Alt code with CP1252. This happens to be the case for most of the first 256 characters in Unicode, as they mostly match up with CP1252 in both order and position. This equivalency does not hold however of rhigher numbers.

Other IME's provided by m17n that may be of potential interest to you include 'Latin-Post' and 'Latin-Pre' which let you add specific characters after or before a letter to produce diacritical marks or special letters (for that you would use either e' or 'e respectively), and 'RFC 1345', which uses RFC 1345 mnemonics to allow inputting a vast majority of the widely used characters from the Unicode BMP (and would use the same e' as the 'Latin-Post' method).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.