File: session.sh

package info (click to toggle)
e16 1.0.0-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 7,884 kB
  • ctags: 6,655
  • sloc: ansic: 70,548; sh: 9,928; xml: 2,606; perl: 479; makefile: 394; sed: 16
file content (58 lines) | stat: -rwxr-xr-x 1,110 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
#
# Default script for e16 session start/restart/stop management
#
# Assuming misc.session.enable_script is set and misc.session.script
# points to this script it will be called with parameter
#
# - "init"  first time an X-session (with e16) starts
# - "start" every time e16 (re)starts
# - "stop"  when e16 exits without restarting
#
# On init, start, and stop the script will run any executable found in
# ~/.e16/Init/, ~/.e16/Start/, and ~/.e16/Stop/, respectively.
# These executables do not have to exit as they are called with '&' from here.
#
# NOTE:
# In multi-display/screen setups the DISPLAY environment variable can be used
# to differentiate.
#

#echo $DISPLAY

RunApps() {
	local d;

	d="$ECONFDIR/$1"
	test -d "$d" || return

	for f in "$d"/*
	do
		if [ -x "$f" ]; then
#			echo $f
			case "$f" in
			*~)	# Assume this is crap - skip
				;;
			*.sh)	# Scripts are executed in foreground
				"$f"
				;;
			*)	# Anything else is executed in background
				"$f"  &
				;;
			esac
		fi
	done
}


case "$1" in
init)
	RunApps Init
	;;
start)
	RunApps Start
	;;
stop)
	RunApps Stop
	;;
esac