#!/bin/bash { runtime="${XDG_RUNTIME_DIR}/i3blocks" [[ ! -d "$runtime" ]] && mkdir -p "$runtime" [[ ! -f "$runtime/keyboard" ]] && [[ -z "$button" ]] && button=1 case $button in 1) swaymsg input "type:keyboard" xkb_variant bepo_afnor; echo "bépo" > "$runtime/keyboard";; 2) swaymsg input "type:keyboard" xkb_variant oss; echo "oss " > "$runtime/keyboard";; 3) swaymsg input "type:keyboard" xkb_variant us; echo "qwer" > "$runtime/keyboard";; esac } &>/dev/null cat "$runtime/keyboard"