0

My system is:

  • OS: Ubuntu 20.10 x86_64
  • Host: MacBook5,1 1.0
  • Kernel: 5.8.0-44-generic

On terminal I have:

$ cat /etc/default/keyboard

  • XKBLAYOUT=pt
  • XKBVARIANT=mac_sundeadkeys
  • BACKSPACE=guess

$ setxkbmap -query -v 10

Applied rules from evdev:
rules: evdev
model: macbook79
layout: pt
variant: sundeadkeys
options: lv3:ralt_switch,compose:rwin,terminate:ctrl_alt_bksp
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete+numpad(mac)
compat: complete
symbols: pc+macintosh_vndr/pt(sundeadkeys)+inet(evdev)+level3(ralt_switch)+compose(rwin)+terminate(ctrl_alt_bksp)
geometry: macintosh(macbook79)
rules: evdev
model: macbook79
layout: pt
variant: sundeadkeys
options: lv3:ralt_switch,compose:rwin,terminate:ctrl_alt_bksp

$ gsettings get org.gnome.desktop.input-sources sources

  • [('xkb', 'pt+mac_sundeadkeys')]

$ xmodmap -pk | egrep "\(e\)"

  • 26 0x0065 (e) 0x0045 (E) 0x0065 (e) 0x0045 (E) 0x20ac (EuroSign) 0x0045 (E) 0x20ac (EuroSign)

$ xmodmap -pk | egrep "\(3\)"

  • 12 0x0033 (3) 0x0023 (numbersign) 0x0033 (3) 0x0023 (numbersign) 0x00a3 (sterling) 0x00a3 (sterling) 0x00a3 (sterling)

Also, gnome-tweaks > Keyboard & Mouse > Additional Layout Options > Adding currency signs to certain keys does not have Euro on 3.

Finally, here's a photo of the keyboard.

2
  • 1
    It may be worth mentioning that by default you can type € via <AltGr>+E. Mar 3, 2021 at 13:38
  • ubuntu custom keyboard shortcut to 'xdotool key ' then probably the sterling one - here gitlab.com/cunidev/gestures/-/wikis/xdotool-list-of-key-codes - EcuSign 0x10020a0 U+20A0 EURO-CURRENCY SIGN - set your shortcut key to the ound key on your keyboard. this could be done in a script to apply to only certain windows, testing for window title with xdotool getwindowname etc.
    – pierrely
    Mar 4, 2021 at 5:05

1 Answer 1

0

The simplest way to do this would be with xmodmap. Changing Shift+3 from $ to € is as simple as doing this:

  1. Open Terminal (if it's not already open)

  2. Send an edit to xmodmap:

    xmodmap -e "keycode  12 = 3 EuroSign 3 EuroSign"
    

    This takes effect immediately and will persist until the next time you reboot, allowing you to try it out. If you'd like to set it back to the original value (without rebooting), you can do this via Terminal:

    xmodmap -e "keycode  12 = 3 dollar 3 dollar"
    

To make this setting permanent, you can create an xmodmap profile and have it load at boot. This is how you do it:

  1. Open Terminal (if it's not already open)
  2. In your home directory, create a dot-file for the profile. For the sake of this example, I'll use .xmodmap:
    vi .xmodmap
    
    Note: Feel free to use any text editor. It does not need to be vi.
  3. Add the keycode mapping:
    keycode  12 = 3 EuroSign 3 EuroSign
    
  4. Save the file and exit the text editor
  5. Create a file called .xinitrc in your home directory:
    vi .xinitrc
    
  6. Add this line:
    xmodmap .xmodmap
    
  7. Save the file and exit

Now every time you sign into Ubuntu, your Shift+3 will be mapped to €.

IMPORTANT: If there are other people who use the computer who would also like this mapping, the steps above will need to be carried out for every user account.

4
  • Now I have: Shift -> €; Alt -> £; and # disappeared.
    – mykahveli
    Mar 4, 2021 at 10:54
  • I don’t understand the comment. Just the [Shift] key results in €? Just the [Alt] key results in £? And there is no further option for #? Is this correct? 🤔
    – user1091774
    Mar 4, 2021 at 10:57
  • Yes to all your questions, indeed. Alt-E gives me € too.
    – mykahveli
    Mar 4, 2021 at 11:01
  • Here's the output of $ xmodmap -pke.
    – mykahveli
    Mar 4, 2021 at 11:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .