blob: a7a7fcf7fdd81ecbd86669f158af70d074da6969 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001#!/bin/sh
2# Stolen from the debian kdm setup, aren't I sneaky
3# Plus a lot of fun stuff added
4# -George
5
6PATH="/usr/bin:$PATH"
7OLD_IFS=$IFS
8
9gdmwhich () {
10 COMMAND="$1"
11 OUTPUT=
12 IFS=:
13 for dir in $PATH
14 do
15 if test -x "$dir/$COMMAND" ; then
16 if test "x$OUTPUT" = "x" ; then
17 OUTPUT="$dir/$COMMAND"
18 fi
19 fi
20 done
21 IFS=$OLD_IFS
22 echo "$OUTPUT"
23}
24
25sysresources=/etc/X11/Xresources
26
27# merge in defaults
28if [ -f "$sysresources" ]; then
29 xrdb -merge "$sysresources"
30fi
31
32sysmodmap=/etc/X11/Xmodmap
33
34XMODMAP=`gdmwhich xmodmap`
35if [ "x$XMODMAP" != "x" ] ; then
36 if [ "x$GDM_PARENT_DISPLAY" = "x" ]; then
37 if [ -f $sysmodmap ]; then
38 $XMODMAP $sysmodmap
39 fi
40 else
41 ( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $XMODMAP -pke ) | $XMODMAP -
42 fi
43
44 #
45 # Switch Sun's Alt and Meta mod mappings
46 #
47
48 UNAME=`gdmwhich uname`
49 PROCESSOR=`$UNAME -p`
50 if [ "x$PROCESSOR" = "xsparc" ]; then
51 if $XMODMAP | /usr/bin/grep mod4 | /usr/bin/grep Alt > /dev/null 2>/dev/null
52 then
53 $XMODMAP -e "clear Mod1" \
54 -e "clear Mod4" \
55 -e "add Mod1 = Alt_L" \
56 -e "add Mod1 = Alt_R" \
57 -e "add Mod4 = Meta_L" \
58 -e "add Mod4 = Meta_R"
59 fi
60 fi
61fi
62
63SETXKBMAP=`gdmwhich setxkbmap`
64if [ "x$SETXKBMAP" != "x" ] ; then
65 # FIXME: is this all right? Is this completely on crack?
66 # What this does is move the xkb configuration from the GDM_PARENT_DISPLAY
67 # FIXME: This should be done in code. Or there must be an easier way ...
68 if [ -n "$GDM_PARENT_DISPLAY" ]; then
69 XKBSETUP=`( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $SETXKBMAP -v )`
70 if [ -n "$XKBSETUP" ]; then
71 XKBKEYMAP=`echo "$XKBSETUP" | grep '^keymap' | awk '{ print $2 }'`
72 XKBTYPES=`echo "$XKBSETUP" | grep '^types' | awk '{ print $2 }'`
73 XKBCOMPAT=`echo "$XKBSETUP" | grep '^compat' | awk '{ print $2 }'`
74 XKBSYMBOLS=`echo "$XKBSETUP" | grep '^symbols' | awk '{ print $2 }'`
75 XKBGEOMETRY=`echo "$XKBSETUP" | grep '^geometry' | awk '{ print $2 }'`
76 if [ -n "$XKBKEYMAP" ]; then
77 $SETXKBMAP -keymap "$XKBKEYMAP"
78 elif [ -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" -a -n "$XKBGEOMETRY" ]; then
79 $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS" -geometry "$XKBGEOMETRY"
80 elif [ -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" ]; then
81 $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS"
82 elif [ -n "$XKBSYMBOLS" ]; then
83 $SETXKBMAP -symbols "$XKBSYMBOLS"
84 fi
85 fi
86 fi
87fi
88
89# FIXME: the housekeeping below really should be moved to the postinst of packages that require it
90# brute force approach for now
91update-desktop-database
92glib-compile-schemas /usr/share/glib-2.0/schemas/
93
94#x11vnc -q -bg -display :0 -forever -avahi -xkb
95
96exit 0