Score:0

Cannot type square brackets with Spanish keyboard layout in Ubuntu 22.04.1 LTS

mk flag

I have just started using Ubuntu 22.04.1 LTS while following a coding course and cannot find how to type neither square brackets or curly braces with the usual key combinations for a Spanish keyboard layout. I have been a Windows user for many years, but just got started with Ubuntu not long ago and still getting used to all the little differences.

When I press the usual key combinations, which are Left Ctrl + Left Alt + one of the pink tinted keys in the Spanish keyboard layout image linked below, nothing happens.

Spanish keabord layout

I have checked and made sure that the correct Spanish layout is setup in the system settings and tried all the other Spanish options just in case, but none of them have solved the issue.

My current keyboard layout is this.

After much searching without any luck, this post made me think it may be that some other setting is interfering and preventing the key combinations I need from working as expected, but I have tried following what is indicated in it and it hasn't solved the problem. Also, Left Ctrl + Left Alt + T works fine for opening a terminal window, so maybe it is not that at all.

I have found a way to type the needed characters by pressing Right Alt (which is Alt Gr on a Spanish keyboard) + one of the needed keys, but it is a very uncomfortable way to achieve it (need to move my left hand over to the right for having both hands on one side of the keyboard) and I'm sure there must be a better solution that escapes me.

Hope someone can lend a hand. Thank you!

Score:0
uz flag

Right Alt or AltGr is the default key on Linux systems to access 3rd and 4th level symbols. But you can change that, if you like.

  • Go to Settings -> Keyboard
  • Click "Alternate Characters Key"
  • Disable "Use layout default"
  • Choose one of the keys for the purpose
DomingoGS avatar
mk flag
Hi Gunnar, thank you very much for your answer. I had already tried that, but I checked again and it doesn't seem to work. However, something a bit strange does seem to happen. If I disable "use layout default", the only other options it lets me apply are "None" and "Right Alt". The rest do not appear as selected when I close the selection window. If I select "Right Alt" nothing changes and if I select "None" the <kbd>AlrGr</kbd> key stops working for typing the characters, but the <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>[</kbd> still doesn't type anything.
Gunnar Hjalmarsson avatar
uz flag
@DomingoGS: Hmm.. You ran into [bug #2000423](https://launchpad.net/bugs/2000423). For some reason I forgot that when writing the answer. It's about to be fixed. But actually you can pick other options but "None" and "Right Alt". Just ignore what the UI tells you. The UI is wrong. :/ But please forget about the Ctrl+Alt combo. AFAIK that's not possible to use for this purpose on Linux.
Gunnar Hjalmarsson avatar
uz flag
@DomingoGS: A fixed version of `gnome-control-center` is now available in jammy-proposed.
DomingoGS avatar
mk flag
I see. Thanks for telling me about the bug. I had no idea. About the <kbd>Ctrl</kbd> + <kbd>Alt</kbd> combo, I must say I find it hard to accept that there is no other solution. That would mean that every programmer in the world that uses a Spanish keyboard layout in a Linux system finds him/herself forced to dismiss the way they have learned how to type the square brackets and curly braces characters and learn a new way to do it. Are you totally sure that's really the case?
Gunnar Hjalmarsson avatar
uz flag
@DomingoGS: No, I'm not totally sure. Probably it's possible to edit some file under `/usr/share/X11/xkb`, but I don't know how to do that. If you run `man xkeyboard-config` and scroll to the "Key to choose the 3rd level" section, you see a full list of the options which XKB offers out of the box. All those options are one single modifier key; combos are not mentioned. The moral of the story is that if you switch operating system, don't expect every single detail to work exactly the same way as in the OS you left. :/
DomingoGS avatar
mk flag
Of course. Never expected it to be all the same in Linux. I'm just a little surprised that It is so hard to be able to use the standard Spanish Keyboard layout in the way it is supposed to. Anyhow, thank you very much for taking time out of your day to help (I sincerely appreciate it) and also for mentioning the xkeyboard configuration. I feel it is an option worth exploring and I will be sure to post the solution if and when I find it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.