Skip to content

Instantly share code, notes, and snippets.

@brahimmachkouri
Created April 3, 2025 09:39
Show Gist options
  • Save brahimmachkouri/8aec3444d7d3592da744deb7304b9e0d to your computer and use it in GitHub Desktop.
Save brahimmachkouri/8aec3444d7d3592da744deb7304b9e0d to your computer and use it in GitHub Desktop.
Installation d'un clavier Apple sous Ubuntu server 22.04 avec Xubuntu
#!/usr/bin/env bash
set -e
echo "==== Configuration clavier Apple AZERTY pour Ubuntu Server 22.04 avec Xubuntu ===="
############################################
# 1. Configuration LightDM pour session Xubuntu + clavier AZERTY Apple
############################################
LIGHTDM_DIR="/etc/lightdm/lightdm.conf.d"
LIGHTDM_CONF="${LIGHTDM_DIR}/00-azerty-apple.conf"
echo "-> Création de ${LIGHTDM_CONF} pour LightDM"
sudo mkdir -p "${LIGHTDM_DIR}"
cat <<EOF | sudo tee "${LIGHTDM_CONF}" > /dev/null
[Seat:*]
display-setup-script=setxkbmap -model apple -layout fr
user-session=xubuntu
EOF
echo "✅ LightDM configuré avec session Xubuntu et clavier Apple AZERTY"
############################################
# 2. Configuration du clavier système (console + fallback)
############################################
KEYBOARD_CONF="/etc/default/keyboard"
echo "-> Mise à jour de ${KEYBOARD_CONF}"
sudo cp "${KEYBOARD_CONF}" "${KEYBOARD_CONF}.bak"
cat <<EOF | sudo tee "${KEYBOARD_CONF}" > /dev/null
XKBMODEL="apple"
XKBLAYOUT="fr"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"
EOF
# Reconfigurer le clavier console
sudo dpkg-reconfigure -f noninteractive keyboard-configuration
sudo service keyboard-setup restart
echo "✅ Clavier système configuré en AZERTY Apple"
############################################
# 3. Suggestion de redémarrage
############################################
echo "✅ Configuration terminée."
echo "🔁 Il est recommandé de redémarrer le système : sudo reboot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment