File: dot.xsession.pl

package info (click to toggle)
language-env 0.64
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,588 kB
  • ctags: 125
  • sloc: perl: 6,243; makefile: 83; tcl: 64; sh: 18
file content (121 lines) | stat: -rw-r--r-- 2,893 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#xs comment -*-coding: iso-8859-9;-*-
X oturumu acilirken etkin olacak ayar ve programlar
END
X oturumu alrken etkin olacak ayar ve programlar
END

if ($DOTFILECONTENTS2 eq "") {
	print <<"EOF";
# Force a spesific X window manager.
# WINDOW_MANAGER=x-window-manager
	
# Set the Turkish locale.
LANG=$LOCALE
export LANG

# NLS for old motif applications.
if [ -d /usr/X11R6/lib/X11/nls ]; then
	XNLSPATH=/usr/X11R6/lib/X11/nls
	export XNLSPATH
fi

EOF

	if ($EXTENDED) {
		print <<"EOF";
# Setup the X keyboard.  Doesn't normally work for GNOME 2.x, 
# since it has its own setup.  Comment out the following if 
# you always prefer to setup the keyboard via GNOME keyboard
# configuration ("Desktop Preferences->Keyboard").
KTYPE=$KTYPE

EOF
	}

	print <<'EOF';
# Apply Debian scheme to determine the startup.
if [ -n "$WINDOW_MANAGER" ] && which $WINDOW_MANAGER >/dev/null 2>&1; then
	realstartup=$WINDOW_MANAGER
elif [ -x /usr/bin/x-session-manager ]; then
	realstartup=x-session-manager
elif [ -x /usr/bin/x-window-manager ]; then
	realstartup=x-window-manager
else
	err="$0: unable to start X session --- nothing sensible found; aborting."
	echo "$err" | fold -s -w ${COLUMNS:-80} >&2
	if [ -n "$DISPLAY" ] && which xmessage >/dev/null 2>&1; then
		echo "$err" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
	fi

	exit 1
fi

# Support for SSH.
if grep -qs ^use-ssh-agent /etc/X11/Xsession.options; then
	sshagent=/usr/bin/ssh-agent; sshagentargs=
	if [ -x $sshagent -a -z "$SSH_AUTH_SOCK" -a -z "$SSH2_AUTH_SOCK" ]; then
		if [ -f /usr/bin/ssh-add1 ] && \
		   cmp -s /usr/bin/ssh-agent /usr/bin/ssh-agent2; then
			# Use ssh-agent2's ssh-agent1 compatibility mode.
			sshagentargs=-1
		fi
		realstartup="$sshagent $sshagentargs $realstartup"
	fi
fi

EOF

	if ($EXTENDED) {
		print <<'EOF';
if [ -n "$KTYPE" ] && which setxkbmap >/dev/null; then
	case "$KTYPE" in
		q|Q)		variant="basic"  ;;
		f|F)		variant="tr_f"   ;;
		alt|qalt|QALT)	variant="tr_alt" ;;
		*)		variant="basic"  ;;
	esac
	
	# XXX: Extremely ugly hack to rule GNOME!
	hackmode=
	case "$realstartup" in
		*gnome-session)
			hackmode=gnome
			;;
		x-session-manager)
			if stat -c %N /etc/alternatives/x-session-manager | \
			   grep -q '/usr/bin/gnome-session' >/dev/null 2>&1; then
				hackmode=gnome
			fi
			;;
	esac

	if [ "$hackmode" = gnome ] && which gconftool-2; then
		gconftool-2 --type bool --set \
		  /desktop/gnome/peripherals/keyboard/xkb/overrideSettings true
	fi >/dev/null 2>&1

	rules="xfree86"; model="pc105"; layout="tr"; option="caps:shift"
	setxkbmap -rules   $rules   \
		  -model   $model   \
		  -layout  $layout  \
		  -variant $variant \
		  -option  $option
fi

EOF
	}

	print <<'EOF';
# Read the user resources database.
if [ -f ~/.Xresources ]; then
	xrdb -merge ~/.Xresources
fi

# Read the user keymaps.
if [ -f ~/.Xmodmap ]; then
	xmodmap ~/.Xmodmap
fi

exec $realstartup
EOF
}