summaryrefslogtreecommitdiff
path: root/X11/Xsession.d/39-lightdm-dmrc-fix
blob: 310de6749f5e78c2b44a8630e90b1a942250ef9e (plain)
  1. #!/bin/bash
  2. # workaround for session language selection in lightdm greeter
  3. # use .dmrc or accountsservice data (if accounts-daemon is running)
  4. # origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679386#107
  5. # we need this only if lightdm is being used
  6. if pidof lightdm; then
  7. # if accountsservice is used, get info from there.
  8. if pidof accounts-daemon; then
  9. LANGFILE="/var/lib/AccountsService/users/$USER"
  10. # if not, use .dmrc
  11. else
  12. LANGFILE="$HOME/.dmrc"
  13. fi
  14. # extract, fix and export $LANG
  15. TEMPLANG=$(cat "$LANGFILE" | grep ^Language= | cut -d '=' -f 2 | sed 's/utf8/UTF8/')
  16. [ ! -z "$TEMPLANG" ] && export LANG=$TEMPLANG
  17. # convert $LANG to $LANGUAGE and export
  18. TEMPLANGUAGE="$(echo $LANG | cut -d '@' -f 1 | cut -d '.' -f 1):$(echo $LANG | cut -d '@' -f 1 | cut -d '.' -f 1 | cut -d '_' -f 1)"
  19. [ ! -z "$TEMPLANGUAGE" ] && export LANGUAGE=$TEMPLANGUAGE
  20. fi