xsay: add support for sselp and xclip; output error message
[grml-scripts.git] / usr_bin / grml-lang
1 #!/bin/sh
2 # Filename:      grml-lang
3 # Purpose:       load specific keyboard layout settings
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 # Latest change: Mon Apr 09 13:04:40 CEST 2007 [mika]
8 ################################################################################
9
10 usage(){
11     echo "Usage: $0 <language>"
12     echo "supported values: at, de, ch, us"
13 }
14
15 if [ $# -lt "1" ] ; then
16    usage
17    exit -1
18 fi
19
20 if [ -z "$DISPLAY" ] ;then
21   if [ "$1" = "de" ] ; then
22     echo "Loading keymap for Germany..."
23     sudo loadkeys i386/qwertz/de-latin1-nodeadkeys.kmap.gz
24     echo -e "\nDone."
25   elif [ "$1" = "at" ] ; then
26     echo "Loading keymap for Austria..."
27     sudo loadkeys i386/qwertz/de-latin1-nodeadkeys.kmap.gz
28     echo -e "\nDone."
29   elif [ "$1" = "ch" ] ; then
30     echo "Loading keymap for Switzerland..."
31     sudo loadkeys i386/qwertz/sg-latin1.kmap.gz
32     echo -e "\nDone."
33   elif [ "$1" = "us" ] ; then
34     echo 'Loading keymap us...'
35     sudo loadkeys i386/qwerty/us-latin1.kmap.gz
36     echo -e "\nDone."
37   else echo "No valid parameter given.
38
39 Notice: Use loadkeys on console and setxkbmap when running X for
40 modifying keyboard layout. Adjust \$LANG and \$LC_ALL for setting locales." ; exit 1
41   fi
42   # switch to unicode mode on console
43   case $LANG in *UTF-8) kbd_mode -u ; ;; esac
44 else
45   if [ $# = 0 ] ; then
46       echo "Usage: $0 <language>"
47       echo "supported values: at, de, ch, us"
48   else
49     if [ "$1" = "de" ] ; then
50       echo "Loading keymap for Germany..."
51       [ -r $HOME/.Xmodmap.german ] && xmodmap $HOME/.Xmodmap.german || setxkbmap de
52       echo -e "\nDone."
53     elif [ "$1" = "at" ] ; then
54       echo "Loading keymap for Austria..."
55       setxkbmap de
56       echo -e "\nDone."
57     elif [ "$1" = "ch" ] ; then
58       echo "Loading keymap for Switzerland..."
59       setxkbmap ch
60       echo -e "\nDone."
61     elif [ "$1"  = "us" ] ; then
62       echo 'Loading keymap us...'
63       [ -r $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap || setxkbmap us
64       echo -e "\nDone."
65     else
66       echo "No valid parameter given."
67       echo
68       usage
69       echo
70       echo "Notice: Use loadkeys on console and setxkbmap when running X for
71 modifying keyboard layout. Adjust \$LANG and \$LC_ALL for setting locales." ; exit 1
72     fi
73   fi
74 fi
75
76 ## END OF FILE #################################################################