#!/bin/bash if [[ -n $(setxkbmap -query | grep fr -o) ]]; then setxkbmap us -variant dvp else setxkbmap fr fi # To display us or fr according to current keyboard # setxkbmap -query | grep -oE "us|fr"