Created
August 1, 2025 13:47
-
-
Save fhbash/8f8abe491e0bcd78d6af60a48a714e47 to your computer and use it in GitHub Desktop.
Simple script to configure Cedilla on Gnome/KDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # fix-cedilla | |
| # | |
| # This is a very simple script to configure your personal ".XCompose" file and | |
| # your environment so that typing 'c will generate a cedilla c instead of an | |
| # accented c. | |
| # | |
| # For further information, visit: | |
| # https://gist.github.com/fhbash/8f8abe491e0bcd78d6af60a48a714e47 | |
| # | |
| # (C) Fellipe Henrique <me@fhbash.com> | |
| # 1. Create ~/.XCompose with proper remapping | |
| echo "Setting up ~/.XCompose for cedilla support..." | |
| cat > "$HOME/.XCompose" <<EOF | |
| include "%L" | |
| <dead_acute> <c> : "ç" U00E7 | |
| <dead_acute> <C> : "Ç" U00C7 | |
| EOF | |
| # 2. Add XCOMPOSEFILE to shell config (bash or zsh) | |
| echo "Configuring XCOMPOSEFILE environment variable..." | |
| SHELLRC="" | |
| if [ -f "$HOME/.bashrc" ]; then | |
| SHELLRC="$HOME/.bashrc" | |
| elif [ -f "$HOME/.zshrc" ]; then | |
| SHELLRC="$HOME/.zshrc" | |
| else | |
| echo "No .bashrc or .zshrc found. Please export XCOMPOSEFILE manually if needed." | |
| fi | |
| if [ -n "$SHELLRC" ]; then | |
| if ! grep -q 'XCOMPOSEFILE=.*\.XCompose' "$SHELLRC"; then | |
| echo 'export XCOMPOSEFILE="$HOME/.XCompose"' >> "$SHELLRC" | |
| echo "Added XCOMPOSEFILE to $SHELLRC" | |
| else | |
| echo "XCOMPOSEFILE is already set in $SHELLRC" | |
| fi | |
| fi | |
| # 3. Reload keyboard layout | |
| echo "Reloading keyboard layout..." | |
| setxkbmap -option '' && setxkbmap | |
| # 4. Apply XCOMPOSEFILE to Flatpak apps (if any) | |
| echo "Applying XCOMPOSEFILE to Flatpak applications..." | |
| for app in $(flatpak list --app --columns=application); do | |
| flatpak override --user --env=XCOMPOSEFILE="$HOME/.XCompose" "$app" | |
| done | |
| echo "" | |
| echo "Compose remapping for cedilla (ç) is now configured." | |
| echo "Please log out and log back in to ensure all changes take effect." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment