#!/bin/sh

# Copyright: 2017 Alf Gaida <agaida@siduction.org>
# License: WTFPL-2
#
#  0. You just DO WHAT THE FUCK YOU WANT TO.

[ ! -f /usr/bin/setxkbmap ] && exit 0
[ ! -f /usr/bin/localectl ] && exit 0

xkbmap=$(setxkbmap -query | grep layout | awk -F':' '{print $2}')
locale=$(localectl | grep 'X11 Layout' | awk -F':' '{print $2}')
if [ "$xkbmap" != "$locale" ]; then
    if [ ! -f "$HOME/.config/xkbfirstrun" ]; then
         setxkbmap $locale;
         touch  "$HOME/.config/xkbfirstrun"
    fi
fi

