sddm-setup (1445B)
1 #!/bin/sh 2 # sddm runs this as root before the sign-in screen shows, sddm's own first. the sign-in screen has no screen reader, 3 # so with one picked at install it says out loud what to do there 4 /usr/share/sddm/scripts/Xsetup 5 grep -qx reader=1 /etc/chamesle/access 2>/dev/null && command -v espeak-ng >/dev/null || exit 0 6 LANG=$(sed -n 's/^LANG=//p' /etc/locale.conf 2>/dev/null); export LANG=${LANG:-C.UTF-8} 7 _() { python3 -c 'import gettext, sys; gettext.textdomain("chamesle"); sys.stdout.write(gettext.gettext(sys.argv[1]))' "$1" 2>/dev/null || printf %s "$1"; } 8 l=${LANG%%[_.]*}; [ "$l" = C ] && l=en 9 say=$(_ "Chamesle sign-in. Type your password and press Enter. After you sign in, the screen reader starts.") 10 w=/run/chamesle-sign-in.wav 11 # english when espeak has no voice for the language 12 espeak-ng -v "$l" -w $w "$say" 2>/dev/null || espeak-ng -w $w "$say" 2>/dev/null 13 # only while the sign-in screen is up: the sound card has to be free when the desktop's sound starts, or the desktop 14 # gets no sound at all, its screen reader included. with automatic sign-in it never comes up 15 ( 16 for i in $(seq 50); do pgrep -f sddm-greeter >/dev/null && break; sleep 0.2; done 17 if pgrep -f sddm-greeter >/dev/null; then 18 sleep 1 19 aplay -q $w 2>/dev/null & 20 p=$! 21 while kill -0 $p 2>/dev/null; do 22 pgrep -f sddm-greeter >/dev/null || kill $p 23 sleep 0.2 24 done 25 fi 26 rm -f $w 27 ) & 28 exit 0