#!/bin/bash

runtime="${XDG_RUNTIME_DIR}/i3blocks"
[[ ! -d "$runtime" ]] && mkdir -p "$runtime"

[[ ! -f "$runtime/keyboard" ]] && [[ -z "$button" ]] && button=1

case $button in
	1) setxkbmap fr bepo_afnor; echo "bépo" > "$runtime/keyboard";;
	3) setxkbmap fr oss; echo "oss " > "$runtime/keyboard";;
	2) setxkbmap fr us; echo "qwer" > "$runtime/keyboard";;
esac

cat "$runtime/keyboard"