summaryrefslogtreecommitdiff
path: root/X11
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2013-02-13 16:01:56 +0100
committerJonas Smedegaard <dr@jones.dk>2013-02-13 16:01:56 +0100
commitedd4dacdcf11f57b6f838de302a57b95d8f1861a (patch)
tree593417eba311ff6008a0469c93e75e4352a495ba /X11
parent3e8a63580af41b9925c40c50e68fb545a5a0f152 (diff)
Add workaround for lightdm ignoring LANG (but#679386).
Diffstat (limited to 'X11')
-rw-r--r--X11/Xsession.d/39-lightdm-dmrc-fix24
1 files changed, 24 insertions, 0 deletions
diff --git a/X11/Xsession.d/39-lightdm-dmrc-fix b/X11/Xsession.d/39-lightdm-dmrc-fix
new file mode 100644
index 0000000..310de67
--- /dev/null
+++ b/X11/Xsession.d/39-lightdm-dmrc-fix
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# workaround for session language selection in lightdm greeter
+# use .dmrc or accountsservice data (if accounts-daemon is running)
+
+# origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679386#107
+
+# we need this only if lightdm is being used
+if pidof lightdm; then
+ # if accountsservice is used, get info from there.
+ if pidof accounts-daemon; then
+ LANGFILE="/var/lib/AccountsService/users/$USER"
+ # if not, use .dmrc
+ else
+ LANGFILE="$HOME/.dmrc"
+ fi
+
+ # extract, fix and export $LANG
+ TEMPLANG=$(cat "$LANGFILE" | grep ^Language= | cut -d '=' -f 2 | sed 's/utf8/UTF8/')
+ [ ! -z "$TEMPLANG" ] && export LANG=$TEMPLANG
+ # convert $LANG to $LANGUAGE and export
+ 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)"
+ [ ! -z "$TEMPLANGUAGE" ] && export LANGUAGE=$TEMPLANGUAGE
+fi