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:
(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:
BACKSPACE=guess
XKBLAYOUT=no
XKBVARIANT=mac
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.
lv3:ralt_switch
to be able to access 3:rd and 4:th level symbols (which should not be needed to set inxkb-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.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.