I originally asked a question here: Is it possible to write special characters using the alt key? but was asked to submit a new question including more info

I want to be able to type special characters such as ellipsis, en dash and em dash using the same key combinations as in osx (that is, alt+period for ellipsis, alt+hyphen for en dash, alt+shift+hyphen for em dash, etc.) Apparently, Right Alt is supposed to function this way natively. Both of my Alt keys work as normal Alt keys in keyboard shortcuts, but I'm not able to use them to create special characters.

My keyboard looks like this:

enter image description here

(with eject instead of power button). Ubuntu's original Norwegian (macbook) layout has a lot of errors ( | instead of ' etc.), so I use a custom layout file that I found on github: github.com/gulrotkake/Ubuntu-MacBook-Norwegian-keyboard I checked the file, and the 3rd and 4th level characters are included:

key <AB09>  { [    period,      colon, ellipsis,   periodcentered ] };
key <AB10>  { [     minus, underscore,       endash,       emdash ] };

I tried changing back to the original layout file (which I had stored as a backup), but I am still not able to produce any of the special characters.

I followed the advice of this post: Setup 3rd/4th level characters (typographic layout) by going into org.gnome.desktop.input-sources and adding 'lv3:ralt_switch', 'misc:typo'. gsettings get org.gnome.desktop.input-sources xkb-options now outputs ['ctrl:swap_lwin_lctl', 'compose:rwin', 'lv3:ralt_switch', 'misc:typo']

This lets me write 3rd and 4th level characters with my Right Alt key, but they aren't mapped correctly (and I'm also no longer able to use the Right Alt key in my keyboard shortcuts). When I type alt+period I get » instead of ellipsis, alt+hyphen gives ellipsis instead of en dash, and so on.

I'm using Ubuntu 20.04 LTS

Edit: cat /etc/default/keyboard outputs:


gsettings get org.gnome.desktop.input-sources sources outputs:

[('xkb', 'no+mac'), ('ibus', 'mozc-jp')]

I|ve tried using the custom keyboard layout from github as well as the default one. The behavior of the two keyboard layouts is the same: i normally cant write any special characters using Right Alt. Adding 'lv3:ralt_switch', I can write the characters but they are mapped incorrectly. Pressing the period key gives me . : · ÷ and pressing the hyphhen key gives me - _ ̣ ˙
Adding 'lv3:ralt_switch', 'misc:typo' the mapping is different but still incorrect. pressing the period key gives me . : » > and pressing the hyphen key gives me - _ … ˙

Also, this might or might not be relevant, but before I switched to the github layout I tried to fix the wrong bindings on the default layout using sudo dpkg-reconfigure keyboard-configuration - choosing MacBook Pro international and norwegian. This made æ å ø and several other keys disappear. And this persisted on reboot. I fixed it by switching to the github layout. I|m unsure whether the Right Alt key functioned properly before doing this.

  • I may take a closer look later, but first I notice a misconception: When you use lv3:ralt_switch to be able to access 3:rd and 4:th level symbols (which should not be needed to set in xkb-options,btw, since it's done behind the scenes by the Norwegian layout), you can no longer use <Right Alt> as a regular <Alt> for various shortcuts. So you need to choose. Possibly that's a difference compared to Mac which you may need to live with. – Gunnar Hjalmarsson May 5 at 19:46
  • Hmm... I see that the Norway - Macintosh layout on the github page does not enable lv3:ralt_switch automatically. Is that the layout you are using? It's a rather important piece of info which you should include in your question. – Gunnar Hjalmarsson May 5 at 20:00

There is a simple explanation: The symbols you want to be able to type (ellipsis, endash and emdash) are not present in the Norwegian (Macintosh) keyboard layout, neither with the original Norwegian symbols file nor with the file you picked from the github project. The lines from the no file you included in your question are not made use of in Norwegian (Macintosh).

One way to type those symbols is to add the basic Norwegian keyboard layout to your list of input sources and switch to that layout.

| 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.