Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to simplify the way I add Unicode characters. At least to make them easier as in Windows for ASCII characters for new comers.

Right now for example to add the letter Ñ I have to press CTRL+SHIFT+U and then type the unicode character 00D1 and then press space.

What I want is to combine the CTRL+SHIFT+U part into one press. For example, pressing a special key I do not use would trigger the CTRL+SHIFT+U behaviour and I would just need to add the code part.

How can I combine this 3 keys (CTRL, SHIFT, U) into one, including the property of having to press them at the same time.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

A program like xmacro may be of help:

 xmacrorec can be used to record mouse and keyboard events on any X11 display.
 .
 xmacroplay can be used to playback recorded events or send any other
 mouse/keyboard events you choose. It is very handy for scripting an
 X display - for example controlling a presentation in mgp or ultrapoint
 from a script, network connection...
 .
 xmacroplay-keys is a script to help use the above.

If I'm understanding this correctly, you'd first define a macro for ctrl+shift+u (note it's shift rather than control, your original post has a small mistake in this respect), then use use Ubuntu's keyboard shortcuts to execute xmacroplay to "play back" your macro.

I have to admit I haven't really tried this myself, as I think a much better solution would be to ask yourself why your users need to enter cryptic Unicode characters by hand, instead of having a keyboard layout that allows them to do so natively. You mention the specific case of Ñ, which can be very easily entered in spanish or latin american keyboard layouts.

Moreover, if you have a US keyboard, you can use the "English (International AltGr dead keys)" layout to enter special characters for many languages, mainly by using AltGr (e.g. AltGr+n = ñ, AltGr+vowel = accents (áéíóú) and so on) .

I suggest you configure this keyboard layout and then click on the small keyboard icon in the Keyboard Layouts control panel to see all the key mappings; chances are, most special characters you are likely to need can be entered with this layout and it will be easier to remember than Unicode codes and three-key combinations, since the mappings are generally quite intuitive (AltGr + ? = ¿, for instance).

I also disagree with the idea that entering ASCII characters in Windows is easier for newcomers. The key is just as arbitrary (Alt + NumPad?), the codes are just as arbitrary to memorize (and it breaks my heart to see the little ASCII code charts pasted on people's desks), and this "crutch" also stems from the same underlying problem, which is a misconfigured keyboard layout.

I do apologize for ranting, and I hope my answer proves useful; if you are unable for some reason to set a keyboard layout as I suggest, maybe you could update your question with more details in this regard so either I or someone else can provide a more useful solution.

share|improve this answer
    
Thanks, edited the question to fix the typo. I also did not know about the dead key and the xmacrorec did do the trick. –  Luis Alvarado Jun 13 '12 at 1:37
    
If AltGr+n does not work with your current keyboard layout, you may also try ~+n, it works with English International (and also Brazilian) layout regardless of AltGr dead key config –  MestreLion Nov 22 '12 at 15:19
    
Same goes for many accented characters (common in French, Portuguese, Spanish, etc): '+o=ó, ~+a=ã, and so on... –  MestreLion Nov 22 '12 at 15:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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