Set KB shortcut command to type £

Is there a way to set a simple Keyboard shortcut that allows me to type the £ symbol without the long winded ctrl + shift [u a 3] sequence.?
Ideally Id like it to be alt+3 or alt+shift+3

My laptop is Japanese KB layout. Ill need to use £ as the main currency when I move to the UK next month. It needs to be a simple shortcut, Ill be typing it often.

The command attempt below doesnt work, is there something like that I can set up?
Im not sure if its possible to return a result via command in this way.

Screenshot from 2021-10-03 11-51-48

Manjaro 21.1.4 Gnome 40.4

Read The Fine Manual… :arrow_down:

man xmodmap

Pay special attention to the keycode option. :wink:


1 Like

Thanks. That opened up some useful exploration.

xmodmap -pke shows me that the £ symbol is already mapped to the 3 key. So now I’m wondering how to actually type it.

keycode  12 = 3 numbersign 3 sterling threesuperior sterling
keycode  13 = 4 dollar 4 dollar EuroSign onequarter

Both Sterling & Euro will be useful. They seem to be level 4 & level 5 respectively.

  • level 4 = mode_switch+Shift+key
  • level 5 = AltGraph+key

Im not sure how to do mode_switch, perhaps that is the ctl+shift u a combination I am trying to avoid?
I dont have an AltGraph Key, but I understand Ctrl+Alt is the same thing, but that doesn’t work. According to the above, Ctrl+Alt+4 should be Euro but it has no effect.

Ctrl+Alt+3 / Ctrl+Alt+4 would be quite acceptable to me for typing £/Euro but it doesnt seem like Ctrl+Alt is working as AltGr.

ctrl+shift+ [ua3] = £
ctrl+shift+ [ua4] = ¤
Not sure what that last one is, its not Euro & not in the xmodmap keycode for that key.

There is a setting to change the alternate characters key in Gnome 40. Just look under the keyboard settings.

Thanks. Yes I tried this, but no effect.
I tried left-alt & right-ctrl as the key, but it has no effect to any key on the keyboard.

Actually I do have Fcitx5 input method installed, which allows me to switch from US to JP(mozc) layouts using the special Kana key on my keyboard.
Perhaps this is affecting some functions…

It’s been a while, but I’m re-visiting this.

I have found that Sn3ipen was correct about the Alt Char Key - If I change my Gnome settings > KB > input source to “US intl” I can type alternate chars using the key I designate.
Unfortunately my KB is Japanese & there are NO alt chars shown in Gnome for any key. I cannot use a different layout (US) because then the KB will function incorrectly.

What I need to do is add my own 3rd level characters in the JP layout.

xmodmap seems unrelated or perhaps not implemented in gnome 41.2. The character mapping it reports in the layout table are not present in my actual layout.

So how can I edit the JP keyboard layout in Gnome, to add some level3 chars? I don’t know how to find or access the layout file - its certainly not what xmodmap -pke reports. Is Gnome using a different solution these days?

My actual keyboard, as shown in Gnome settings: (no level3 chars)

  • Seems like the xmodmap layout is not being used:
xmodmap -pke 
keycode  10 = 1 exclam 1 exclam onesuperior exclamdown
keycode  11 = 2 quotedbl 2 quotedbl twosuperior oneeighth
keycode  12 = 3 numbersign 3 sterling threesuperior sterling
keycode  13 = 4 dollar 4 dollar EuroSign onequarter
keycode  14 = 5 percent 5 percent onehalf threeeighths
keycode  15 = 6 ampersand 6 asciicircum threequarters fiveeighths
keycode  16 = 7 apostrophe 7 ampersand braceleft seveneighths
keycode  17 = 8 parenleft 8 asterisk bracketleft trademark
keycode  18 = 9 parenright 9 parenleft bracketright plusminus
keycode  19 = 0 asciitilde 0 parenright braceright degree

OK, I finally solved it!
As I suspected xmodmap is not being used, Manjaro with Wayland uses XKD
To modify your keys it is actually very simple.

  • The keyboard layout files are in /usr/share/X11/xkb/symbols/
  • in my case I wanted to add some level3 symbols to my JP layout. So I edited the file JP file adding sterling & EuroSign
sudo nano '/usr/share/X11/xkb/symbols/jp'  
xkb_symbols "common" {
    // "Common" keys for jp 106/109A layouts.

    key <HZTG> {
        symbols[Group1]= [ Zenkaku_Hankaku, Kanji ]

    key <AE01> { [ 1, exclam            ] };
    key <AE02> { [ 2, quotedbl          ] };
    key <AE03> { [ 3, numbersign, sterling      ] };
    key <AE04> { [ 4, dollar, EuroSign          ] };
    key <AE05> { [ 5, percent           ] };
    key <AE06> { [ 6, ampersand         ] };
  • save & this will immediately be reflected in your Settings > Keyboard > input source layout, but you will need to reboot for it to start working.
  • make sure you have set: Settings > Keyboard > Alternative Characters Key, which you will use to type the Level 3 characters you added.

Screenshot from 2022-01-24 13-59-51

£€£€£€£€£€£€ :smiling_face_with_three_hearts:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.