43

I prefer to use US international with dead keys keyboard layout in order to get Latin diacritics for characters like é, è, à, etc in Libreoffice in Linux Mint.

On this layout characters like ´, `, ^, " are dead keys (clicked once do nothing) that can be pressed before other letters in order to get these signs.

' with a gives á
` with a gives à
" with a gives ä

etc, but

' with c gives ć

Can I get ç in this layout in Linux?


In Windows I do not have 'US international with dead keys' but only 'US international' which seems identical, only there dead-key ' with c gives ç (in both MSOffice and LibreOffice), which I think is the expected behavior.


I had imagined this might be a all-around system-level problem in Linux. But this keyboard layout (mentioned in a comment by user BramMooij under this question) can produce in Linux the cedilla under C (Ç) with AltGr-c.

9
  • 1
    Can't test specifically for US keyboard, but for me on International Eng simply alt/c gives ç - no dead key required
    – Tetsujin
    Commented May 12, 2016 at 9:20
  • @Tetsujin - do you have the other diacritics in that layout, all the other French letters? Take a look at my other question please: superuser.com/q/1075998/162573
    – user162573
    Commented May 12, 2016 at 9:23
  • @Tetsujin - I'm afraid this is OS and application specific. I will update the question and give all details (about Linux). In Windows with MSOffice 2013 things are different.
    – user162573
    Commented May 12, 2016 at 9:30
  • That was the conclusion I was coming to too - your dead keys are totally different to mine. Mine are e,u,i,n and ` for ´ ¨ ^ `and ~
    – Tetsujin
    Commented May 12, 2016 at 9:31
  • @Tetsujin - this is because of the different keyboard layouts.
    – user162573
    Commented May 12, 2016 at 9:32

8 Answers 8

43

The key combination for ç in US international with dead keys layout was there all along, but unlike the other Latin diacritics it does not involve a dead key:

AltGr+,=ç

AltGr+Shift+,=Ç

enter image description here

5
  • 3
    My keyboard doesn't have the AltGr key. What can I do? Commented Jun 18, 2020 at 1:42
  • 5
    @FernandoSilveira normally it's just right alt Commented Feb 6, 2021 at 10:25
  • @YuriFeldman My keyboard doesn't have it. It has only the left Alt key. Commented Feb 8, 2021 at 13:04
  • Then maybe this thread can help - it proposes to install gnome-tweaks, and choose the alternative characters key from there askubuntu.com/questions/1030248/… Commented Feb 9, 2021 at 12:20
  • The right Alt + , solved for me since my keyboard does not have AltGr specifically. Commented May 17 at 14:19
40

It's because the cedilla module isn't loaded by default when the locale is set to en, so you have to change the configuration files for gtk to add them:

1. Edit configuration files:

sudo vim /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache

sudo vim /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache

On both, find the lines starting with "cedilla" "Cedilla" and add :en to the line. Something like this:

"cedilla" "Cedilla" "gtk30" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa:en"

2. Change the Compose file:

sudo sed -i /usr/share/X11/locale/en_US.UTF-8/Compose -e 's/ć/ç/g' -e 's/Ć/Ç/g'

3. Instruct the system to load the cedilla module:

Add those lines to /etc/environment:

GTK_IM_MODULE=cedilla
QT_IM_MODULE=cedilla

Reboot and you are done.

7
  • 1
    Thank you so much! Also, I cross posted your answer on AskUbuntu: askubuntu.com/questions/30655/… LMK if you want to post it yourself so I can remove my answer :)! Commented Jan 28, 2019 at 10:22
  • After some updates on the OS, this workaround stops working. Are there any permanent ways that aren't affected by updates?
    – Luciano
    Commented Aug 9, 2019 at 20:25
  • There's no workaround that I know. As the changed files are part of the OS, any update will overwrite the files. You can create a bash script to alter the files again, so when you update, you can run the script again and change the files again.
    – ThoriumBR
    Commented Aug 9, 2019 at 20:35
  • How can I do that without root access, affecting only my user? I can't access root or run sudo commands :/ Commented May 8, 2020 at 14:17
  • 1
    Since I've installed Ubuntu 23.04 this seems to work only for GTK2 and GTK3 apps, doesn't work for any GTK4.0 app. Anyone had the same issue?
    – euDennis
    Commented May 12, 2023 at 0:55
8

If you like me don't have a AltGr button in your keyboard, try the following:

Right Alt + ,

1
  • My Right Alt is AltGr.
    – Sumax
    Commented May 1, 2020 at 17:46
1

I have created a simple bash script following @ThoriumBR answer. This way, whenever there's an update to your system and you'll lose that config, you can just run the script again.

The script is idempotent, so feel free to run as many time as you want, the result won't change.

#!/usr/bin/env bash

# Setting vars up
COMPOSE_FILE='/usr/share/X11/locale/en_US.UTF-8/Compose'
GTK2_FILE='/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache'
GTK3_FILE='/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache'
ENV_FILE='/etc/environment'

# Backing up files
sudo cp ${COMPOSE_FILE} ${COMPOSE_FILE}.bak
sudo cp ${GTK2_FILE} ${GTK2_FILE}.bak
sudo cp ${GTK3_FILE} ${GTK3_FILE}.bak

# Fixing cedilla in Compose
sudo sed --in-place -e 's/ć/ç/g' ${COMPOSE_FILE}
sudo sed --in-place -e 's/Ć/Ç/g' ${COMPOSE_FILE}

# Fixing cedilla in GTK files
GTK_FILE_SEARCH_FOR='^"cedilla".*:en'
GTK_FILE_SED_EXP='s/^\(\"cedilla\".*:wa\)/\1:en/g'

grep -q ${GTK_FILE_SEARCH_FOR} ${GTK2_FILE}
[ $? -eq 1 ] && sudo sed --in-place -e ${GTK_FILE_SED_EXP} ${GTK2_FILE}
grep -q ${GTK_FILE_SEARCH_FOR} ${GTK3_FILE}
[ $? -eq 1 ] && sudo sed --in-place -e ${GTK_FILE_SED_EXP} ${GTK3_FILE}

# Fixing cedilla in environment file
ENV_FILE_GTK_LINE='GTK_IM_MODULE=cedilla'
ENV_FILE_QT_LINE='QT_IM_MODULE=cedilla'

grep -q ${ENV_FILE_GTK_LINE} ${ENV_FILE}
[ $? -eq 1 ] && echo ${ENV_FILE_GTK_LINE} | sudo tee -a ${ENV_FILE} > /dev/null
grep -q ${ENV_FILE_QT_LINE} ${ENV_FILE}
[ $? -eq 1 ] && echo ${ENV_FILE_QT_LINE} | sudo tee -a ${ENV_FILE} > /dev/null

Then you can save it to a file such as fix-cedilla.sh and run it with bash fix-cedilla.sh. Or you can mark that file as executable with chmod +x fix-cedilla.sh and run it with ./fix-cedilla.sh.

You can/should also add it to your dotfiles repo (example of mine) so next time you (re)install your OS it's handy in a known place ;-)

1

Just open a terminal and execute the following to add the intended behaviour to '+c and '+C

~/.XCompose

echo '<dead_acute> <c>     : "ç"' >>~/.XCompose
echo '<dead_acute> <C>     : "Ç"' >>~/.XCompose

Reboot or alternatively restart GNome with ALT+F2 then type r+ENTER.

0
0

You can use a combination of uim as input manager with a XCompose file to reproduce the Microsoft Windows behavior for English international keyboards.

I've wrote some instructions for several distros (and even a Ubuntu package): https://github.com/raelgc/win_us_intl/

0

I'm on fedora 40 with gnome 46 and the option 2 just works for me

https://github.com/raelgc/win_us_intl/

in resume: Alternative 2: Try with ibus Modern versions of ibus appears to properly handle the .XCompose file.

So, download the file and place it at your home folder (and logout/login) should be enough to get proper latin accents:

cd ~

wget https://raw.githubusercontent.com/raelgc/win_us_intl/master/.XCompose

Logout and login again.

It works fine, but I still have the same weird side effect of Firefox deleting first accent on Whatsapp web under Xorg (no issues in Wayland).

so.. ç Ç á é à :)

0

This method given in ThoriumBR's answer broke other ibus layouts for me. I need both the cedilla on the international layout and the Hangul characters on the Korean (Hangul) layout, applying this method broke the Hangul input method.

This alternative method enables to add the cedilla without breaking Hangul support :

Alternative solution 3 (user space)

1. Create a `~/.XCompose` file with the following content:
 # UTF-8 (Unicode) compose sequences

 # Overrides C acute with Ccedilla:
 <dead_acute> <C> : "Ç" "Ccedilla"
 <dead_acute> <c> : "ç" "ccedilla"
2. Run the following command:
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule': <'ibus'>}"
3. Restart the user session.

Source

0

You must log in to answer this question.