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'm a bit of a fan of the interrobang (‽), but it obviously is not on my keyboard. How can I map that character to a key combination?

share|improve this question
add comment

5 Answers

Another option is to make use of the 'compose' key. Using Ubuntu, choose one in the Keyboard → Layouts → Option configuration (I choose Right Alt). For Kubuntu, go to System Settings → Input Devices → Keyboard → Advanced, check "Configure keyboard options", and then select your chosen key under "Compose key position".

To use the compose key, type Compose + ? + !.

There are lots of useful looking characters you can generate in this way: http://www.hermit.org/Linux/ComposeKeys.html

share|improve this answer
    
Since I'm using Lubuntu, I don't have the same Keyboard configuration software as in GNOME. Any idea how I could do this in Lubuntu? –  mac9416 Aug 15 '10 at 18:22
    
I haven't tested this, but I suppose editing /etc/default/console-setup so that the line with XKBOPTIONS="" becomes XKBOPTIONS="compose:rwin" (or whatever key you want to become the "compose key" or "multi key") should work. Also see the guide that Source Lab refers to, as well as the pages it links to at the bottom for more info about XKB options & key names and such. –  JanC Aug 16 '10 at 4:55
    
For recent versions of console-setup, those options are in /etc/default/keyboard now. –  JanC Jun 9 '11 at 13:29
add comment

In GNOME you can enter unicode characters by type Ctrl+Shift+u+unicode point, followed Space or Enter.

So, type an interrobang, you'd enter Ctrl+Shift+u+2032d+Space.

How cool is that‽ Actually, I think it's a bit clumsy, but it does the job.

share|improve this answer
    
You should add that you need to hit Enter or Space to accept. –  loevborg Aug 15 '10 at 16:24
add comment

Another, low-level option to try, especially if you can't get xkb to work is to use xmodmap directly.

The first thing to do would be to get a sense of your current keyboard layout. Open a terminal and type:

xmodmap -pke

This will give you a list of numbered positions on your keyboard and what they are mapped to. E.g., you might see an entry like:

keycode 14 = 5 percent 5 percent

This means that a certain key is mapped to 5 when pressed normally, the percent sign % when pressed with a shift. (And the next two values are for when Mode_shift is active; but let's not get into that right now.

If I wanted to change this key I could type in:

xmodmap -e "keycode 14 = 5 U203D 5 UD203D"

Now, instead of getting a percent sign % when I type shift-5, I get ‽.

That's just an example; probably you don't want to remap % to ‽. But maybe there's some other key you don't use a lot. For example, one nice option might be to remap the shift-Menu instead. So I see from xmodmap -pke that I have:

xmodmap -e "keycode 135 = Menu Menu Menu Menu"

I might make it instead:

xmodmap -e "keycode 135 = Menu U203D Menu U203D"

If I want to make that permanent, just through it inside some bash script that runs automatically, like .bashrc or .xinitrc, or create your own that Lubuntu loads automatically.

However, it's very important to run xmodmap -pke first to see what your initial set up. Your keycode numbers may well be different from mine. And it's also the best way to see what else is available.

Anyway, that's a very low-level option. If you want a high-level option, look at something like autokey or xdotool instead.

share|improve this answer
add comment

Here's something that works okay:

  1. Install xdotool (brilliant piece of software by the way)
  2. go to System → Preferences → Keyboard Shortcuts
  3. Add a new shortcut, as the command choose xdotool key ctrl+shift+u type "203d "

This is based on Matt's answer,but it will type the keys for you every time you hit the keyboard shortcut (albeit a bit slowly, about 150ms).

To add any other character, go to the gnome character map and search for it; In the status bar you should see the hexadecimal index of the glyph - i.e. "U+203d".

I now have the interrobang mapped to Ctrl+?, see‽ :-)

share|improve this answer
    
Hey, Stefano, thanks for the answer! Since I'm using Lubuntu, I can't find the Keyboard Shortcuts utility. Can you find out what the command for that menu item is? –  mac9416 Nov 27 '10 at 14:25
    
Phew i've never used LXDE, so no idea, but this link could help: en.gentoo-wiki.com/wiki/… –  Stefano Palazzo Nov 27 '10 at 22:04
add comment

You will have to define a custom xkb keyboard layout. I found this guide but I haven't tried it my self.

share|improve this answer
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.